-
-
Notifications
You must be signed in to change notification settings - Fork 17
chore: bump ESLint stack to v15 and migrate to flat config #317
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
Changes from all commits
467c775
cb576bc
9b47a97
66665c1
f0063b3
e99f95d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| import base, { createConfig } from '@metamask/eslint-config'; | ||
| import jest from '@metamask/eslint-config-jest'; | ||
| import nodejs from '@metamask/eslint-config-nodejs'; | ||
| import typescript from '@metamask/eslint-config-typescript'; | ||
| import path from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| const tsconfigRootDir = path.dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| const config = createConfig([ | ||
| ...base, | ||
| { | ||
| ignores: ['coverage/**', 'dist/**', 'docs/**', '.yarn/**'], | ||
| }, | ||
| { | ||
| linterOptions: { | ||
| reportUnusedDisableDirectives: 'error', | ||
| }, | ||
| }, | ||
| { | ||
| rules: { | ||
| // Handled by Oxfmt. | ||
| 'prettier/prettier': 'off', | ||
| 'import-x/order': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.{js,cjs,mjs}', '**/*.test.{js,ts}', '**/tests/**/*.{js,ts}'], | ||
| extends: [nodejs], | ||
| }, | ||
| { | ||
| files: ['**/*.{js,cjs}'], | ||
| languageOptions: { | ||
| sourceType: 'script', | ||
| ecmaVersion: 2020, | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.mjs'], | ||
| languageOptions: { | ||
| sourceType: 'module', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.ts'], | ||
| extends: [typescript], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| tsconfigRootDir, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.test.{js,ts}', '**/tests/**/*.{js,ts}'], | ||
| extends: [jest], | ||
| }, | ||
| // Project-wide rule overrides. These go after every `extends` so they win. | ||
| { | ||
| rules: { | ||
| // TODO: Re-enable these rules. | ||
| // They were not enforced under the legacy eslint-config v12, and fixing | ||
| // roughly 150 JSDoc blocks is out of scope for a config migration. | ||
| // `require-jsdoc` in particular must stay off while suppressed: its | ||
| // autofixer inserts empty `/** */` blocks and mangles surrounding code. | ||
| // Core disables it for the same reason. | ||
| 'jsdoc/require-jsdoc': 'off', | ||
| 'jsdoc/require-param-description': 'off', | ||
| 'jsdoc/require-returns': 'off', | ||
| 'jsdoc/tag-lines': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.ts'], | ||
| rules: { | ||
| // TODO: Re-enable these rules. | ||
| // Newly surfaced by eslint-config v15; not enforced under v12. | ||
| '@typescript-eslint/explicit-function-return-type': 'off', | ||
| '@typescript-eslint/prefer-nullish-coalescing': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.test-d.ts'], | ||
| rules: { | ||
| // In `tsd` type tests the assertions carry the meaning of the test, so | ||
| // the autofixer actively destroys them. Stripping `as any` from | ||
| // `expectAssignable<Json>(null as any)`, for instance, deletes the very | ||
| // thing that assertion exists to prove. | ||
| '@typescript-eslint/no-unnecessary-type-assertion': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.test.{js,ts}'], | ||
| rules: { | ||
| // These tests deliberately reach for `crypto` and `crypto.webcrypto`, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably okay, but I need to double-check this is the right thing to do here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The real reason is described here 8555d3c |
||
| // and polyfill the global when running on Node 18. Flagging them as | ||
| // unsupported defeats the purpose of the polyfill they are testing. | ||
| 'n/no-unsupported-features/node-builtins': 'off', | ||
| }, | ||
| }, | ||
| ]); | ||
|
|
||
| export default config; | ||
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.
Hmm, I thought I fixed this already. I guess not. This is okay for now.