This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Align ESLint, Prettier packages and configs with core monorepo ahead of migration #28
Merged
MajorLift
merged 7 commits into
main
from
230925-migrate-to-monorepo-deps-linter-configs
Sep 28, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fb5c792
Decrement TypeScript to ~4.6.3 ahead of migration to core monorepo
MajorLift 32b7d1a
Update packages for eslint and prettier ahead of migration to core mo…
MajorLift 37cd1df
linter fix from eslint version update
MajorLift ea3cfa2
Apply core monorepo eslint config
MajorLift f1fcb2b
Bump dependency versions to align with core monorepo v77.0.0
MajorLift eecfb70
Bump TypeScript to v4.8.4 to align with planned version update in cor…
MajorLift 67d0db4
Restore TypeScript compiler options that are not enabled in the core …
MajorLift File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,135 @@ | ||
module.exports = { | ||
root: true, | ||
|
||
extends: ['@metamask/eslint-config'], | ||
|
||
extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'], | ||
ignorePatterns: [ | ||
'!.eslintrc.js', | ||
'!jest.config.js', | ||
'node_modules', | ||
'dist', | ||
'docs', | ||
'coverage', | ||
// 'merged-packages', | ||
], | ||
overrides: [ | ||
{ | ||
files: ['*.ts'], | ||
extends: ['@metamask/eslint-config-typescript'], | ||
files: ['*.test.{ts,js}', '**/tests/**/*.{ts,js}'], | ||
extends: ['@metamask/eslint-config-jest'], | ||
rules: { | ||
// TODO: Re-enable | ||
'import/no-named-as-default-member': 'off', | ||
'jest/no-conditional-expect': 'off', | ||
}, | ||
}, | ||
{ | ||
// These files are test helpers, not tests. We still use the Jest ESLint | ||
// config here to ensure that ESLint expects a test-like environment, but | ||
// various rules meant just to apply to tests have been disabled. | ||
files: ['**/tests/**/*.{ts,js}', '!*.test.{ts,js}'], | ||
rules: { | ||
'jest/no-export': 'off', | ||
'jest/require-top-level-describe': 'off', | ||
'jest/no-if': 'off', | ||
'jest/no-test-return-statement': 'off', | ||
// TODO: Re-enable this rule; we can accomodate this even in our test helpers | ||
'jest/expect-expect': 'off', | ||
}, | ||
}, | ||
|
||
{ | ||
files: ['*.js'], | ||
parserOptions: { | ||
sourceType: 'script', | ||
ecmaVersion: '2018', | ||
}, | ||
extends: ['@metamask/eslint-config-nodejs'], | ||
}, | ||
{ | ||
files: ['*.ts'], | ||
extends: ['@metamask/eslint-config-typescript'], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ['./tsconfig.json'], | ||
}, | ||
rules: { | ||
// disabled due to incompatibility with Record<string, unknown> | ||
// See https://github.com/Microsoft/TypeScript/issues/15300#issuecomment-702872440 | ||
'@typescript-eslint/consistent-type-definitions': 'off', | ||
|
||
// TODO: auto-fix breaks stuff | ||
'@typescript-eslint/promise-function-async': 'off', | ||
|
||
// TODO: re-enble most of these rules | ||
'@typescript-eslint/await-thenable': 'warn', | ||
'@typescript-eslint/naming-convention': 'off', | ||
'@typescript-eslint/no-floating-promises': 'warn', | ||
'@typescript-eslint/no-for-in-array': 'warn', | ||
'@typescript-eslint/no-loss-of-precision': 'warn', | ||
'@typescript-eslint/no-misused-promises': 'warn', | ||
'@typescript-eslint/no-unnecessary-type-assertion': 'off', | ||
'@typescript-eslint/unbound-method': 'off', | ||
'@typescript-eslint/prefer-enum-initializers': 'off', | ||
'@typescript-eslint/prefer-nullish-coalescing': 'off', | ||
'@typescript-eslint/prefer-optional-chain': 'off', | ||
'@typescript-eslint/prefer-reduce-type-parameter': 'off', | ||
'@typescript-eslint/restrict-plus-operands': 'warn', | ||
'@typescript-eslint/restrict-template-expressions': 'warn', | ||
'no-restricted-syntax': 'off', | ||
'no-restricted-globals': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['tests/setupAfterEnv/matchers.ts'], | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
}, | ||
{ | ||
files: ['*.test.ts', '*.test.js'], | ||
extends: [ | ||
'@metamask/eslint-config-jest', | ||
'@metamask/eslint-config-nodejs', | ||
], | ||
files: ['*.d.ts'], | ||
rules: { | ||
'@typescript-eslint/naming-convention': 'warn', | ||
'import/unambiguous': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['scripts/*.ts'], | ||
rules: { | ||
// All scripts will have shebangs. | ||
'n/shebang': 'off', | ||
}, | ||
}, | ||
], | ||
rules: { | ||
// Left disabled because various properties throughough this repo are snake_case because the | ||
// names come from external sources or must comply with standards | ||
// e.g. `txreceipt_status`, `signTypedData_v4`, `token_id` | ||
camelcase: 'off', | ||
'id-length': 'off', | ||
|
||
ignorePatterns: [ | ||
'!.eslintrc.js', | ||
'!.prettierrc.js', | ||
'dist/', | ||
'docs/', | ||
'.yarn/', | ||
], | ||
// TODO: re-enble most of these rules | ||
'@typescript-eslint/naming-convention': 'off', | ||
'function-paren-newline': 'off', | ||
'guard-for-in': 'off', | ||
'id-denylist': 'off', | ||
'implicit-arrow-linebreak': 'off', | ||
'import/no-anonymous-default-export': 'off', | ||
'import/no-unassigned-import': 'off', | ||
'lines-around-comment': 'off', | ||
'n/no-sync': 'off', | ||
'no-async-promise-executor': 'off', | ||
'no-case-declarations': 'off', | ||
'no-invalid-this': 'off', | ||
'no-negated-condition': 'off', | ||
'no-new': 'off', | ||
'no-param-reassign': 'off', | ||
'no-restricted-syntax': 'off', | ||
radix: 'off', | ||
'require-atomic-updates': 'off', | ||
'jsdoc/match-description': [ | ||
'off', | ||
{ matchDescription: '^[A-Z`\\d_][\\s\\S]*[.?!`>)}]$' }, | ||
], | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
typescript: {}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: The devDeps being dropped here are inversely pending bumps in
core
here: MetaMask/core#1740