Skip to content

Commit

Permalink
chore(eslint): migrate to eslint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Aug 16, 2024
1 parent 51aadcc commit c437f88
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 14 deletions.
13 changes: 0 additions & 13 deletions .eslintrc.json

This file was deleted.

3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ updates:
commitlint:
patterns:
- '@commitlint/*'
eslint:
patterns:
- '@eslint/*'
prettier:
patterns:
- prettier
Expand Down
50 changes: 50 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';

import { includeIgnoreFile } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import prettier from 'eslint-plugin-prettier';
import simpleImportSort from 'eslint-plugin-simple-import-sort';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
includeIgnoreFile(gitignorePath),

...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
),

{
plugins: {
'@typescript-eslint': typescriptEslint,
prettier,
'simple-import-sort': simpleImportSort,
},

languageOptions: {
parser: tsParser,
},

rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'no-console': 'error',
'no-debugger': 'error',
'prettier/prettier': 'error',
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
},
},
];
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "npm run clean && vite build",
"bundle": "scripts/bundle.sh",
"clean": "rm -rf dist",
"lint": "eslint --ignore-path .gitignore .",
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix",
"lint:tsc": "tsc --noEmit",
"prepare": "husky",
Expand All @@ -22,6 +22,9 @@
"devDependencies": {
"@commitlint/cli": "19.4.0",
"@commitlint/config-conventional": "19.2.2",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.9.0",
"@types/gtag.js": "0.0.20",
"@typescript-eslint/eslint-plugin": "8.1.0",
"@typescript-eslint/parser": "8.1.0",
Expand Down

0 comments on commit c437f88

Please sign in to comment.