Skip to content

Commit

Permalink
fix: update eslint for flat config (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh authored Aug 22, 2024
1 parent 20c4b9a commit cba6cd4
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 241 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

34 changes: 0 additions & 34 deletions .eslintrc

This file was deleted.

66 changes: 66 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import _import from 'eslint-plugin-import';
import { fixupPluginRules } from '@eslint/compat';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: [
'**/coverage',
'**/dist',
'**/cjs',
'**/esm',
'commitlint.config.cjs',
],
},
...compat.extends(
'prettier',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
),
{
plugins: {
import: fixupPluginRules(_import),
},

languageOptions: {
globals: {
...globals.browser,
},

parser: tsParser,
},

settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},

rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
];
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
"build:esm": "tsc -p tsconfig.esm.json && tsc-alias -p tsconfig.esm.json && echo '{\"type\": \"module\"}' > esm/package.json",
"prettier:check": "prettier --check {src,test}/**/*.{js,ts,tsx,json}",
"prettier:write": "prettier --write {src,test}/**/*.{js,ts,tsx,json}",
"hooks:uninstall": "husky uninstall",
"hooks:install": "husky install",
"test:watch": "exit 0",
"hooks:install": "husky",
"test": "exit 0",
"lint": "eslint .",
"type-check": "yarn tsc --noEmit",
Expand All @@ -58,12 +56,16 @@
"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/node": "20.16.1",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"eslint": "8.57.0",
"@typescript-eslint/eslint-plugin": "8.2.0",
"@typescript-eslint/parser": "8.2.0",
"eslint": "9.9.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1",
"globals": "15.9.0",
"husky": "9.1.5",
"i18next": "23.14.0",
"prettier": "3.3.3",
Expand Down
Loading

0 comments on commit cba6cd4

Please sign in to comment.