|
| 1 | +{ |
| 2 | + "root": true, |
| 3 | + "ignorePatterns": [ |
| 4 | + "node_modules/", |
| 5 | + "coverage/", |
| 6 | + "dist/", |
| 7 | + "build/", |
| 8 | + "scripts/**", |
| 9 | + ".*/**/*.js.snap" |
| 10 | + ], |
| 11 | + "env": { |
| 12 | + "node": true, |
| 13 | + "es2021": true, |
| 14 | + "jest": true |
| 15 | + }, |
| 16 | + "parserOptions": { |
| 17 | + "ecmaVersion": "latest", |
| 18 | + "sourceType": "commonjs", |
| 19 | + "ecmaFeatures": { |
| 20 | + "globalReturn": false |
| 21 | + } |
| 22 | + }, |
| 23 | + "plugins": ["prettier", "jest", "import", "node"], |
| 24 | + "extends": [ |
| 25 | + "eslint:recommended", |
| 26 | + "plugin:node/recommended", |
| 27 | + "plugin:jest/recommended", |
| 28 | + "plugin:import/recommended", |
| 29 | + "plugin:prettier/recommended" |
| 30 | + ], |
| 31 | + "settings": { |
| 32 | + "import/ignore": ["node_modules", "\\.json$"], |
| 33 | + "node": { |
| 34 | + "tryExtensions": [".js", ".json", ".node"] |
| 35 | + } |
| 36 | + }, |
| 37 | + "rules": { |
| 38 | + "prettier/prettier": [ |
| 39 | + "error", |
| 40 | + { |
| 41 | + "endOfLine": "auto" |
| 42 | + } |
| 43 | + ], |
| 44 | + |
| 45 | + /* Preferred style */ |
| 46 | + "quotes": [ |
| 47 | + "error", |
| 48 | + "double", |
| 49 | + { "avoidEscape": true, "allowTemplateLiterals": true } |
| 50 | + ], |
| 51 | + "semi": ["error", "always"], |
| 52 | + "indent": [ |
| 53 | + "error", |
| 54 | + 4, |
| 55 | + { "SwitchCase": 1, "ignoredNodes": ["TemplateLiteral"] } |
| 56 | + ], |
| 57 | + "comma-dangle": ["error", "only-multiline"], |
| 58 | + |
| 59 | + /* Best practices */ |
| 60 | + "eqeqeq": ["error", "always"], |
| 61 | + "no-var": "error", |
| 62 | + "prefer-const": ["error", { "destructuring": "all" }], |
| 63 | + "curly": ["error", "multi-line"], |
| 64 | + "no-implicit-coercion": "error", |
| 65 | + "no-unsafe-optional-chaining": "error", |
| 66 | + "consistent-return": "off", |
| 67 | + |
| 68 | + /* Practical runtime safety (nice for bots) */ |
| 69 | + "no-console": ["warn", { "allow": ["warn", "error", "info"] }], |
| 70 | + "no-constant-condition": ["error", { "checkLoops": false }], |
| 71 | + "no-useless-return": "warn", |
| 72 | + "no-unreachable-loop": "error", |
| 73 | + |
| 74 | + /* Node-specific */ |
| 75 | + "node/no-unsupported-features/es-syntax": "off", |
| 76 | + "node/no-unpublished-require": "off", |
| 77 | + "node/no-missing-require": "off", |
| 78 | + |
| 79 | + /* Import plugin */ |
| 80 | + "import/no-unresolved": "off", |
| 81 | + "import/no-extraneous-dependencies": "off", |
| 82 | + "node/no-extraneous-require": "off", |
| 83 | + "no-redeclare": "off", |
| 84 | + "import/order": [ |
| 85 | + "error", |
| 86 | + { |
| 87 | + "groups": [ |
| 88 | + "builtin", |
| 89 | + "external", |
| 90 | + "internal", |
| 91 | + "parent", |
| 92 | + "sibling", |
| 93 | + "index" |
| 94 | + ], |
| 95 | + "newlines-between": "always", |
| 96 | + "alphabetize": { "order": "asc", "caseInsensitive": true } |
| 97 | + } |
| 98 | + ], |
| 99 | + |
| 100 | + /* Common relaxations for this project */ |
| 101 | + "no-unused-vars": [ |
| 102 | + "warn", |
| 103 | + { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" } |
| 104 | + ], |
| 105 | + |
| 106 | + /* Jest */ |
| 107 | + "jest/no-disabled-tests": "warn", |
| 108 | + "jest/no-focused-tests": "error", |
| 109 | + "jest/no-identical-title": "error", |
| 110 | + |
| 111 | + /* Code clarity */ |
| 112 | + "max-len": [ |
| 113 | + "warn", |
| 114 | + { |
| 115 | + "code": 120, |
| 116 | + "ignoreUrls": true, |
| 117 | + "ignoreStrings": true, |
| 118 | + "ignoreTemplateLiterals": true |
| 119 | + } |
| 120 | + ] |
| 121 | + }, |
| 122 | + |
| 123 | + "overrides": [ |
| 124 | + { |
| 125 | + "files": ["**/__tests__/**", "**/*.test.js", "**/*.spec.js"], |
| 126 | + "env": { "jest": true }, |
| 127 | + "rules": { |
| 128 | + "no-unused-expressions": "off", |
| 129 | + "no-console": "off" |
| 130 | + } |
| 131 | + }, |
| 132 | + { |
| 133 | + "files": ["scripts/**", "*.config.js", "**/bin/**"], |
| 134 | + "rules": { |
| 135 | + "no-console": "off" |
| 136 | + } |
| 137 | + } |
| 138 | + ] |
| 139 | +} |
0 commit comments