diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index a43883d7..00000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - root: true, - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - }, - env: { - node: true, - es6: true, - }, - extends: ['eslint:recommended', 'plugin:prettier/recommended'], - ignorePatterns: ['coverage', '.eslintrc.cjs'], - overrides: [ - { - files: ['**/*.test.js'], - plugins: ['jest'], - extends: ['plugin:jest/recommended', 'plugin:jest/style'], - env: { - jest: true, - }, - }, - ], -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..4ff68c54 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,46 @@ +import js from '@eslint/js'; +import prettierConfig from 'eslint-plugin-prettier/recommended'; +import jestPlugin from 'eslint-plugin-jest'; +import globals from 'globals'; + +export default [ + { + files: ['**/*.js'], + }, + { + // Ignore patterns + ignores: ['coverage/**'], + }, + js.configs.recommended, + prettierConfig, + { + // Base settings + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + globals: { + ...globals.node, + ...globals.es6, + }, + }, + rules: { + 'prettier/prettier': 'warn', + }, + }, + { + // Jest settings for test files + files: ['**/*.test.js'], + languageOptions: { + globals: { + ...globals.jest, + }, + }, + plugins: { + jest: jestPlugin, + }, + rules: { + ...jestPlugin.configs.recommended.rules, + ...jestPlugin.configs.style.rules, + }, + }, +]; diff --git a/package.json b/package.json index a41ddca8..0bca3107 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "license": "MIT", "type": "module", "scripts": { - "lint:eslint": "eslint . --ext .js", + "lint:eslint": "eslint .", "lint:prettier": "prettier ./**/*.{json,md,yml} --check", "lint": "npm run lint:eslint && npm run lint:prettier", "lint:fix": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write",