Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(permission-controller)!: Fix various lint rule violations #4521

Merged
merged 9 commits into from
Jul 17, 2024
88 changes: 88 additions & 0 deletions packages/permission-controller/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
module.exports = {
extends: ['../../.eslintrc.js'],

overrides: [
{
files: [
'src/PermissionController.test.ts',
'src/rpc-methods/revokePermissions.test.ts',
],
rules: {
// This is taken directly from @metamask/[email protected]
'@typescript-eslint/naming-convention': [
'error',
// We have to disable the default selector for our objectLiteralProperty
// filter to work.
// {
// selector: 'default',
// format: ['camelCase'],
// leadingUnderscore: 'allow',
// trailingUnderscore: 'forbid',
// },
{
selector: 'enumMember',
format: ['PascalCase'],
},
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false,
},
},
{
selector: 'objectLiteralMethod',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
},
// This option is modified by the addition of a filter.
{
selector: 'objectLiteralProperty',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
filter: {
// Match RPC method names like foo_bar, foo_barBaz, etc., and metamask.io
regex: '(^[a-z]+_[a-z]+[a-zA-Z0-9]*)|metamask\\.io$',
match: false,
},
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: 'typeParameter',
format: ['PascalCase'],
custom: {
regex: '^.{3,}',
match: true,
},
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'allow',
},
{
selector: 'parameter',
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow',
},
{
selector: [
'classProperty',
'objectLiteralProperty',
'typeProperty',
'classMethod',
'objectLiteralMethod',
'typeMethod',
'accessor',
'enumMember',
],
format: null,
modifiers: ['requiresQuotes'],
},
],
},
},
],
};
Loading
Loading