diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 6aac1da..0000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules/ -lib/ -dist/ \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 22b6f1c..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "env": { "node": true, "jest": true }, - "parser": "@typescript-eslint/parser", - "parserOptions": { "ecmaVersion": 9, "sourceType": "module" }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "plugin:import/errors", - "plugin:import/warnings", - "plugin:import/typescript", - "plugin:prettier/recommended" - ], - "plugins": ["@typescript-eslint"] -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..ab09933 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,58 @@ +import github from 'eslint-plugin-github' +import jest from 'eslint-plugin-jest' +import prettier from 'eslint-plugin-prettier/recommended' + +const githubConfigs = github.getFlatConfigs() + +export default [ + { + ignores: ['**/node_modules/**', '**/lib/**', '**/dist/**'] + }, + githubConfigs.recommended, + ...githubConfigs.typescript, + prettier, + { + files: ['**/*.ts'], + languageOptions: { + parserOptions: { + project: './tsconfig.eslint.json' + } + }, + rules: { + // Prettier + 'prettier/prettier': ['error', {endOfLine: 'auto'}], + + // Disable rules that conflict with project style + 'eslint-comments/no-use': 'off', + 'github/no-then': 'off', + 'github/filenames-match-regex': 'off', + 'github/array-foreach': 'off', + 'import/no-namespace': 'off', + 'import/no-commonjs': 'off', + 'import/named': 'off', + 'import/no-unresolved': 'off', + 'i18n-text/no-en': 'off', + 'filenames/match-regex': 'off', + 'no-shadow': 'off', + 'no-unused-vars': 'off', + 'no-undef': 'off', + camelcase: 'off', + + // TypeScript rules + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-shadow': 'off', + '@typescript-eslint/array-type': 'off', + '@typescript-eslint/no-require-imports': 'off' + } + }, + { + files: ['**/__tests__/**/*.ts'], + ...jest.configs['flat/recommended'], + rules: { + ...jest.configs['flat/recommended'].rules, + 'jest/expect-expect': 'off', + 'jest/no-conditional-expect': 'off' + } + } +] diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 0000000..dca6f21 --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "." + }, + "include": ["src/**/*.ts", "__tests__/**/*.ts", "*.ts"], + "exclude": ["node_modules", "lib", "dist"] +}