Skip to content

Commit

Permalink
Migrate ESLint 8 → 9
Browse files Browse the repository at this point in the history
- Migrates to flat config
- Replaces eslint-plugin-import with eslint-plugin-import-x
  • Loading branch information
Destiner committed Sep 21, 2024
1 parent c3b898b commit 6173e2e
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 52 deletions.
49 changes: 0 additions & 49 deletions .eslintrc.json

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.
59 changes: 59 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* eslint-disable import-x/no-extraneous-dependencies */
import js from '@eslint/js';
import eslintPluginImportX from 'eslint-plugin-import-x';
import globals from 'globals';
import { configs as tsConfigs, parser as tsParser } from 'typescript-eslint';

export default [
js.configs.recommended,
eslintPluginImportX.flatConfigs.recommended,
eslintPluginImportX.flatConfigs.typescript,
...tsConfigs.recommended,
{
languageOptions: {
parser: tsParser,
globals: {
...globals.node,
},
ecmaVersion: 2020,
sourceType: 'module',
},
rules: {
'import-x/first': 'error',
'import-x/exports-last': 'error',
'import-x/newline-after-import': 'error',
'import-x/prefer-default-export': 'error',
'import-x/group-exports': 'error',
'import-x/no-duplicates': 'error',
'import-x/no-amd': 'error',
'import-x/no-commonjs': 'error',
'import-x/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
'newlines-between': 'always',

alphabetize: {
order: 'asc',
},
},
],
'import-x/no-unused-modules': 'error',
'import-x/no-mutable-exports': 'error',
'import-x/no-extraneous-dependencies': [
'error',
{
devDependencies: ['src/**/*.test.ts'],
},
],
'@typescript-eslint/explicit-function-return-type': 'error',
},
},
];
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
"prepack": "npm run build"
},
"devDependencies": {
"@eslint/js": "^9.11.0",
"@types/bun": "^1.1.8",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"eslint": "^8.57.0",
"eslint": "^9.11.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-import-x": "^4.2.1",
"prettier": "^3.3.3",
"typescript": "5.4.3",
"typescript-eslint": "^8.6.0",
"vitest": "^2.0.5"
}
}

0 comments on commit 6173e2e

Please sign in to comment.