1 const globals = require("globals");
2 const js = require("@eslint/js");
3 const erb = require("eslint-plugin-erb");
4 const stylisticJs = require("@stylistic/eslint-plugin-js");
7 js.configs.recommended,
8 erb.configs.recommended,
11 "app/assets/javascripts/i18n/",
19 "@stylistic": stylisticJs
33 updateLinks: "readonly"
37 // The "unused disable directive" is set to "warn" by default.
38 // For the ERB plugin to work correctly, you must disable
39 // this directive to avoid issues described here
40 // https://github.com/eslint/eslint/discussions/18114
41 // If you're using the CLI, you might also use the following flag:
42 // --report-unused-disable-directives-severity=off
43 reportUnusedDisableDirectives: "off"
46 "@stylistic/array-bracket-newline": ["error", "consistent"],
47 "@stylistic/array-bracket-spacing": "error",
48 "@stylistic/block-spacing": "error",
49 "@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }],
50 "@stylistic/comma-dangle": "error",
51 "@stylistic/comma-spacing": "error",
52 "@stylistic/comma-style": "error",
53 "@stylistic/computed-property-spacing": "error",
54 "@stylistic/dot-location": ["error", "property"],
55 "@stylistic/eol-last": "error",
56 "@stylistic/func-call-spacing": "error",
57 "@stylistic/indent": ["error", 2, {
59 VariableDeclarator: "first",
60 FunctionDeclaration: { parameters: "first" },
61 FunctionExpression: { parameters: "first" },
62 CallExpression: { arguments: "first" }
64 "@stylistic/key-spacing": "error",
65 "@stylistic/keyword-spacing": "error",
66 "@stylistic/no-floating-decimal": "error",
67 "@stylistic/no-mixed-operators": "error",
68 "@stylistic/no-multiple-empty-lines": "error",
69 "@stylistic/no-multi-spaces": "error",
70 "@stylistic/no-trailing-spaces": "error",
71 "@stylistic/no-whitespace-before-property": "error",
72 "@stylistic/object-curly-newline": ["error", { consistent: true }],
73 "@stylistic/object-curly-spacing": ["error", "always"],
74 "@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
75 "@stylistic/operator-linebreak": ["error", "after"],
76 "@stylistic/padded-blocks": ["error", "never"],
77 "@stylistic/quote-props": ["error", "consistent-as-needed", { keywords: true, numbers: true }],
78 "@stylistic/quotes": ["error", "double"],
79 "@stylistic/semi": ["error", "always"],
80 "@stylistic/semi-spacing": "error",
81 "@stylistic/semi-style": "error",
82 "@stylistic/space-before-blocks": "error",
83 "@stylistic/space-before-function-paren": ["error", { named: "never" }],
84 "@stylistic/space-in-parens": "error",
85 "@stylistic/space-infix-ops": "error",
86 "@stylistic/space-unary-ops": "error",
87 "@stylistic/switch-colon-spacing": "error",
88 "@stylistic/wrap-iife": "error",
89 "@stylistic/wrap-regex": "error",
91 "accessor-pairs": "error",
92 "array-callback-return": "error",
93 "block-scoped-var": "error",
94 "curly": ["error", "multi-line", "consistent"],
95 "dot-notation": "error",
96 "eqeqeq": ["error", "smart"],
98 "no-array-constructor": "error",
100 "no-console": "warn",
101 "no-div-regex": "error",
102 "no-eq-null": "error",
104 "no-extend-native": "error",
105 "no-extra-bind": "error",
106 "no-extra-label": "error",
107 "no-implicit-coercion": "warn",
108 "no-implicit-globals": "error",
109 "no-implied-eval": "error",
110 "no-invalid-this": "error",
111 "no-iterator": "error",
112 "no-labels": "error",
113 "no-label-var": "error",
114 "no-lone-blocks": "error",
115 "no-lonely-if": "error",
116 "no-loop-func": "error",
117 "no-multi-str": "error",
118 "no-negated-condition": "error",
119 "no-nested-ternary": "error",
121 "no-new-func": "error",
122 "no-new-wrappers": "error",
123 "no-object-constructor": "error",
124 "no-octal-escape": "error",
125 "no-param-reassign": "error",
127 "no-script-url": "error",
128 "no-self-compare": "error",
129 "no-sequences": "error",
130 "no-throw-literal": "error",
131 "no-undef-init": "error",
132 "no-undefined": "error",
133 "no-unmodified-loop-condition": "error",
134 "no-unneeded-ternary": "error",
135 "no-unused-expressions": "off",
136 "no-unused-vars": ["error", { caughtErrors: "none" }],
137 "no-useless-call": "error",
138 "no-useless-concat": "error",
139 "no-useless-return": "error",
140 "no-use-before-define": ["error", { functions: false }],
142 "no-warning-comments": "warn",
143 "radix": ["error", "always"],
148 // Additional configuration for test files
149 files: ["test/**/*.js"],
160 files: ["config/eslint.js"],
163 sourceType: "commonjs",