-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lint): migrate to eslint v9 + flat config + recommended rules (#867)
* chore(deps): update eslint to v9 and migrate to flat config * fix(eslint): fixup all errors found by the new set of eslint rules BREAKING CHANGE: We updated our config to the recommended typescript-eslint typed rules so some types have become stricter than they were before.
- Loading branch information
Showing
214 changed files
with
8,189 additions
and
18,337 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
printWidth: 120 | ||
tabWidth: 4 | ||
singleQuote: true | ||
bracketSpacing: false |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const Configuration = { | ||
extends: ['@commitlint/config-conventional'], | ||
}; | ||
|
||
export default Configuration; |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
import eslintPluginJest from 'eslint-plugin-jest'; | ||
import jsdoc from 'eslint-plugin-jsdoc'; | ||
import {dirname} from 'node:path'; | ||
import {fileURLToPath} from 'node:url'; | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
|
||
export default tseslint.config( | ||
{ignores: ['dist']}, | ||
{ | ||
extends: [ | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommendedTypeChecked, | ||
jsdoc.configs['flat/recommended-typescript'], | ||
eslintConfigPrettier, | ||
], | ||
languageOptions: { | ||
parserOptions: { | ||
projectService: true, | ||
tsconfigRootDir: __dirname, | ||
}, | ||
}, | ||
rules: { | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
args: 'all', | ||
argsIgnorePattern: '^_', | ||
caughtErrors: 'all', | ||
caughtErrorsIgnorePattern: '^_', | ||
destructuredArrayIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
'@typescript-eslint/prefer-promise-reject-errors': 'warn', | ||
'@typescript-eslint/only-throw-error': 'warn', | ||
'@typescript-eslint/unbound-method': 'warn', | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.spec.ts'], | ||
extends: [eslintPluginJest.configs['flat/recommended']], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
}, | ||
}, | ||
{files: ['**/*.js', '**/*.mjs'], ...tseslint.configs.disableTypeChecked}, | ||
); |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const unmockedDependencies = ['query-string-esm', 'decode-uri-component', 'split-on-first', 'filter-obj']; | ||
|
||
// /* | ||
// * For a detailed explanation regarding each configuration property, visit: | ||
// * https://jestjs.io/docs/configuration | ||
// */ | ||
|
||
export default { | ||
extensionsToTreatAsEsm: ['.ts'], | ||
preset: 'ts-jest/presets/default-esm', | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
'^#query-string': 'query-string-cjs', | ||
}, | ||
transform: { | ||
'^.+\\.[tj]s$': ['ts-jest', {tsconfig: '<rootDir>/../tsconfig.test.json', useESM: true}], | ||
}, | ||
clearMocks: true, | ||
collectCoverage: true, | ||
collectCoverageFrom: ['<rootDir>/**/*.{ts,tsx}'], | ||
coverageDirectory: 'coverage', | ||
setupFiles: ['../jest.setup.ts'], | ||
transformIgnorePatterns: [`node_modules/(?!(${unmockedDependencies.join('|')}))`], | ||
rootDir: './src', | ||
testEnvironment: 'node', | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.