From 273d7d26e1407c6d63fad6d895b1bc6dba933241 Mon Sep 17 00:00:00 2001 From: Pierre Cavin Date: Thu, 9 Jan 2025 19:11:34 +0100 Subject: [PATCH] chore: migrate ESLint config --- .eslintrc.cjs | 19 ------------------- eslint.config.js | 37 +++++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 38 insertions(+), 20 deletions(-) delete mode 100644 .eslintrc.cjs create mode 100644 eslint.config.js diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index a24c2fd..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,19 +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: ['ava'], - }, - ], -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..ce36a77 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,37 @@ +import js from '@eslint/js'; +import prettierConfig from 'eslint-plugin-prettier/recommended'; +import avaPlugin from 'eslint-plugin-ava'; +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', + }, + }, + { + // Ava settings for test files + files: ['test/**/*.js'], + plugins: { + jest: avaPlugin, + }, + }, +]; diff --git a/package.json b/package.json index 6ce43c3..8fbe63d 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "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",