Skip to content

Commit

Permalink
Update eslint to v9
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Apr 7, 2024
1 parent a541163 commit 938037d
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 264 deletions.
135 changes: 135 additions & 0 deletions config/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
const globals = require("globals");
const js = require("@eslint/js");

module.exports = [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 2015,
sourceType: "script",
globals: {
...globals.browser,
...globals.jquery,
Cookies: "readonly",
I18n: "readonly",
L: "readonly",
OSM: "writable",
Matomo: "readonly",
Qs: "readonly",
Turbo: "readonly",
updateLinks: "readonly"
}
},
rules: {
"accessor-pairs": "error",
"array-bracket-newline": ["error", "consistent"],
"array-bracket-spacing": "error",
"array-callback-return": "error",
"block-scoped-var": "error",
"block-spacing": "error",
"brace-style": ["error", "1tbs", { allowSingleLine: true }],
"comma-dangle": "error",
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": "error",
"curly": ["error", "multi-line", "consistent"],
"dot-location": ["error", "property"],
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": ["error", "smart"],
"func-call-spacing": "error",
"indent": ["error", 2, {
SwitchCase: 1,
VariableDeclarator: "first",
FunctionDeclaration: { parameters: "first" },
FunctionExpression: { parameters: "first" },
CallExpression: { arguments: "first" }
}],
"key-spacing": "error",
"keyword-spacing": "error",
"no-alert": "warn",
"no-array-constructor": "error",
"no-caller": "error",
"no-console": "warn",
"no-div-regex": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-floating-decimal": "error",
"no-implicit-coercion": "warn",
"no-implicit-globals": "warn",
"no-implied-eval": "error",
"no-invalid-this": "error",
"no-iterator": "error",
"no-labels": "error",
"no-label-var": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-mixed-operators": "error",
"no-multiple-empty-lines": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-negated-condition": "error",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-param-reassign": "error",
"no-process-env": "error",
"no-proto": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-undefined": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": "off",
"no-unused-vars": ["error", { caughtErrors: "none" }],
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-return": "error",
"no-use-before-define": ["error", { functions: false }],
"no-void": "error",
"no-warning-comments": "warn",
"no-whitespace-before-property": "error",
"object-curly-newline": ["error", { consistent: true }],
"object-curly-spacing": ["error", "always"],
"object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
"operator-linebreak": ["error", "after"],
"padded-blocks": ["error", "never"],
"quote-props": ["error", "consistent-as-needed", { keywords: true, numbers: true }],
"quotes": ["error", "double"],
"radix": ["error", "always"],
"semi": ["error", "always"],
"semi-spacing": "error",
"semi-style": "error",
"space-before-blocks": "error",
"space-before-function-paren": ["error", { named: "never" }],
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": "error",
"switch-colon-spacing": "error",
"wrap-iife": "error",
"wrap-regex": "error",
"yoda": "error"
}
},
{
files: ["config/eslint.js"],
languageOptions: {
ecmaVersion: 2019,
sourceType: "commonjs",
globals: {
...globals.commonjs
}
}
}
];
120 changes: 0 additions & 120 deletions config/eslint.json

This file was deleted.

2 changes: 1 addition & 1 deletion lib/tasks/eslint.rake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def yarn_path
end

def config_file
Rails.root.join("config/eslint.json").to_s
Rails.root.join("config/eslint.js").to_s
end

def js_files
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"qs": "^6.9.4"
},
"devDependencies": {
"eslint": "^8.0.0"
"eslint": "^9.0.0"
}
}
Loading

0 comments on commit 938037d

Please sign in to comment.