From 38f36c664bcc00868cd9ca75dd773db6b9317d9e Mon Sep 17 00:00:00 2001 From: JoshNels <139372369+JoshNels@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:08:19 -0500 Subject: [PATCH] chore(deps): migrate to eslint 9+ --- .eslintignore | 2 - .eslintrc.js | 24 -------- eslint.config.mjs | 149 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 5 +- 4 files changed, 152 insertions(+), 28 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 0769c21..0000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -# Exclude directories generated by the build -app/src/preload diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 4d8bd92..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - "extends": "google", - "env": { - "es6": true, - "node": true - }, - "parserOptions": { - "ecmaVersion": 2020 - }, - "rules": { - // Don't dangle commas. - "comma-dangle": ["error", "never"], - // Pre-ES6 engines need to be able to use objects as maps. - "guard-for-in": "off", - // Increase max line length. - "max-len": ["error", { "code": 120 }], - // This is silly. Negated conditions are highly useful and often much more concise than - // their complements. - "no-negated-condition": "off", - // Error on undeclared variables. Google disables this because it causes problems with Closure-style JS, where - // namespaces are globally defined. In modularized JS, this is a highly useful error. - "no-undef": "error" - } -}; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..a92c261 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,149 @@ +import globals from "globals"; + +export default [ + { + ignores: ["app/src/preload"], + }, + { + languageOptions: { + globals: { + ...globals.node, + }, + ecmaVersion: 2020, + sourceType: "commonjs", + }, + rules: { + "array-bracket-newline": 0, + "array-bracket-spacing": [2, "never"], + "array-element-newline": 0, + "arrow-parens": [2, "always"], + "block-spacing": [2, "never"], + "brace-style": 2, + camelcase: [ + 2, + { + properties: "never", + }, + ], + "comma-dangle": ["error", "never"], + "comma-spacing": 2, + "comma-style": 2, + "computed-property-spacing": 2, + "constructor-super": 2, + curly: [2, "multi-line"], + "eol-last": 2, + "func-call-spacing": 2, + "generator-star-spacing": [2, "after"], + // Pre-ES6 engines need to be able to use objects as maps. + "guard-for-in": "off", + indent: [ + 2, + 2, + { + CallExpression: { + arguments: 2, + }, + FunctionDeclaration: { + body: 1, + parameters: 2, + }, + FunctionExpression: { + body: 1, + parameters: 2, + }, + MemberExpression: 2, + ObjectExpression: 1, + SwitchCase: 1, + ignoredNodes: ["ConditionalExpression"], + }, + ], + "key-spacing": 2, + "keyword-spacing": 2, + "linebreak-style": 2, + "max-len": [ + "error", + { + code: 120, + }, + ], + "new-cap": 2, + "no-array-constructor": 2, + "no-caller": 2, + "no-cond-assign": 0, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-invalid-this": 2, + "no-irregular-whitespace": 2, + "no-mixed-spaces-and-tabs": 2, + "no-multi-spaces": 2, + "no-multi-str": 2, + "no-multiple-empty-lines": [ + 2, + { + max: 2, + }, + ], + "no-negated-condition": "off", + "no-new-object": 2, + "no-new-symbol": 2, + "no-new-wrappers": 2, + "no-tabs": 2, + "no-this-before-super": 2, + "no-throw-literal": 2, + "no-trailing-spaces": 2, + "no-undef": "error", + "no-unexpected-multiline": 2, + "no-unused-vars": [ + 2, + { + args: "none", + }, + ], + "no-var": 2, + "no-with": 2, + "object-curly-spacing": 2, + "one-var": [ + 2, + { + const: "never", + let: "never", + var: "never", + }, + ], + "operator-linebreak": [2, "after"], + "padded-blocks": [2, "never"], + "prefer-const": [ + 2, + { + destructuring: "all", + }, + ], + "prefer-promise-reject-errors": 2, + "prefer-rest-params": 2, + "prefer-spread": 2, + "quote-props": [2, "consistent"], + quotes: [ + 2, + "single", + { + allowTemplateLiterals: true, + }, + ], + "rest-spread-spacing": 2, + semi: 2, + "semi-spacing": 2, + "space-before-blocks": 2, + "space-before-function-paren": [ + 2, + { + anonymous: "never", + asyncArrow: "always", + named: "never", + }, + ], + "spaced-comment": [2, "always"], + "switch-colon-spacing": 2, + "yield-star-spacing": [2, "after"], + }, + }, +]; diff --git a/package.json b/package.json index f9ece0b..6be96c1 100644 --- a/package.json +++ b/package.json @@ -30,11 +30,12 @@ "slash": "^3.0.0" }, "devDependencies": { + "@eslint/js": "^9.6.0", "electron": "^22.3.25", "electron-builder": "^24.13.3", "electron-builder-squirrel-windows": "^24.13.3", - "eslint": "^8.57.0", - "eslint-config-google": "^0.14.0" + "eslint": "9.4.0", + "globals": "^15.8.0" }, "peerDependencies": { "electron": "22.3.25",