Skip to content

Commit

Permalink
Update to eslint v9
Browse files Browse the repository at this point in the history
Switch to using `deno` as that allows referring to the config packages without
having to setup a `package.json` and other stuff required when running `eslint`
through `node` now.
  • Loading branch information
Nemo157 committed Apr 6, 2024
1 parent bb2be06 commit e440177
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 74 deletions.
71 changes: 0 additions & 71 deletions .eslintrc.json

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: denoland/setup-deno@v1
- name: install `just`
run: sudo snap install --edge --classic just
- run: npm install -g eslint@8
- run: just lint-js
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ lint:
cargo clippy --all-features --all-targets --workspace --locked -- -D warnings

lint-js:
eslint static templates gui-tests
deno run -A npm:eslint@9 static templates gui-tests eslint.config.js
74 changes: 74 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import js from "npm:@eslint/js@9";
import globals from "npm:globals@15";

export default [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
},
rules: {
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": ["error", { before: true, after: true }],
"block-scoped-var": "error",
"brace-style": ["error", "1tbs", { allowSingleLine: false }],
"comma-dangle": ["error", "always-multiline"],
"comma-style": ["error", "last"],
"eol-last": ["error", "always"],
"eqeqeq": "error",
"func-call-spacing": ["error", "never"],
"guard-for-in": "error",
"key-spacing": ["error", { beforeColon: false, afterColon: true, mode: "strict" }],
"keyword-spacing": ["error", { before: true, after: true }],
"linebreak-style": ["error", "unix"],
"max-len": ["error", { code: 100, tabWidth: 4 }],
"no-alert": "error",
"no-confusing-arrow": "error",
"no-const-assign": "error",
"no-debugger": "error",
"no-div-regex": "error",
"no-dupe-args": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-ex-assign": "error",
"no-fallthrough": "error",
"no-floating-decimal": "error",
"no-implicit-globals": "error",
"no-implied-eval": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-label-var": "error",
"no-lonely-if": "error",
"no-mixed-operators": "error",
"no-multi-assign": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-template-curly-in-string": "error",
"no-trailing-spaces": "error",
"no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
"no-var": ["error"],
"prefer-arrow-callback": ["error"],
"prefer-const": ["error"],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"space-before-blocks": "error",
"space-before-function-paren": ["error", "never"],
"space-infix-ops": "error",
},
},
{
files: ["static/**/*", "templates/**/*"],
languageOptions: {
globals: globals.browser,
},
},
{
files: ["gui-tests/**/*"],
languageOptions: {
globals: globals.node,
},
},
];

0 comments on commit e440177

Please sign in to comment.