|
| 1 | +import globals from "globals"; |
| 2 | +import js from "@eslint/js"; |
| 3 | +import jest from "eslint-plugin-jest"; |
| 4 | +import eslintConfigPrettier from "eslint-config-prettier"; |
| 5 | + |
| 6 | +/** |
| 7 | + * @type {import("eslint").Linter.Config} |
| 8 | + */ |
| 9 | +export default [ |
| 10 | + { |
| 11 | + "ignores": [".git/", ".github/", ".husky/", ".scannerwork/", ".vscode/", "coverage/", "node_modules/"], |
| 12 | + "name": "Files to ignore" |
| 13 | + }, |
| 14 | + { |
| 15 | + ...eslintConfigPrettier, |
| 16 | + "name": "Prettier" |
| 17 | + }, |
| 18 | + { |
| 19 | + ...js.configs.recommended, |
| 20 | + "files": ["**/*.{js,cjs,mjs}"], |
| 21 | + "languageOptions": { |
| 22 | + "ecmaVersion": 2023 |
| 23 | + }, |
| 24 | + "name": "JavaScript files", |
| 25 | + "rules": { |
| 26 | + ...js.configs.recommended.rules, |
| 27 | + "no-var": "error", |
| 28 | + "no-unused-vars": [ |
| 29 | + "error", |
| 30 | + { |
| 31 | + "argsIgnorePattern": "_.*" |
| 32 | + } |
| 33 | + ] |
| 34 | + } |
| 35 | + }, |
| 36 | + { |
| 37 | + "files": ["**/*.mjs"], |
| 38 | + "languageOptions": { |
| 39 | + "sourceType": "module" |
| 40 | + }, |
| 41 | + "name": "JavaScript modules" |
| 42 | + }, |
| 43 | + { |
| 44 | + "files": ["**/*.{js,cjs,mjs}"], |
| 45 | + "languageOptions": { |
| 46 | + "globals": { |
| 47 | + ...globals.node |
| 48 | + } |
| 49 | + }, |
| 50 | + "name": "Node.js files" |
| 51 | + }, |
| 52 | + { |
| 53 | + ...jest.configs["flat/recommended"], |
| 54 | + "files": ["test/**/*{spec,test}.{js,cjs,mjs}", "test/mocks/jest-mocks.js"], |
| 55 | + "languageOptions": { |
| 56 | + "globals": { |
| 57 | + ...globals.jest |
| 58 | + } |
| 59 | + }, |
| 60 | + "name": "Test files", |
| 61 | + "rules": { |
| 62 | + ...jest.configs["flat/recommended"].rules, |
| 63 | + "jest/prefer-expect-assertions": "off", |
| 64 | + "jest/expect-expect": "off" |
| 65 | + } |
| 66 | + } |
| 67 | +]; |
0 commit comments