Skip to content

Commit

Permalink
refactor eslint config, update deprecated rules
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE committed Jan 11, 2025
1 parent 2a010d7 commit 62bd534
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 107 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
run: npm run setup && npm run js:test

- name: eslint
run: cd assets && npx eslint
run: npx eslint

- uses: actions/upload-artifact@v4
if: always()
Expand Down Expand Up @@ -205,9 +205,6 @@ jobs:
- name: Run e2e tests
run: npm run e2e:test

- name: eslint
run: npx eslint

- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
31 changes: 0 additions & 31 deletions assets/eslint.config.mjs

This file was deleted.

123 changes: 113 additions & 10 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,119 @@
import playwright from "eslint-plugin-playwright"
import jest from "eslint-plugin-jest"
import globals from "globals"
import js from "@eslint/js"
import stylisticJs from "@stylistic/eslint-plugin-js"

import sharedRules from "./eslint.rules.mjs"
const sharedRules = {
"@stylistic/js/indent": ["error", 2, {
SwitchCase: 1,
}],

"@stylistic/js/linebreak-style": ["error", "unix"],
"@stylistic/js/quotes": ["error", "double"],
"@stylistic/js/semi": ["error", "never"],

"@stylistic/js/object-curly-spacing": ["error", "never", {
objectsInObjects: false,
arraysInObjects: false,
}],

"@stylistic/js/array-bracket-spacing": ["error", "never"],

"@stylistic/js/comma-spacing": ["error", {
before: false,
after: true,
}],

"@stylistic/js/computed-property-spacing": ["error", "never"],

"@stylistic/js/space-before-blocks": ["error", {
functions: "never",
keywords: "never",
classes: "always",
}],

"@stylistic/js/keyword-spacing": ["error", {
overrides: {
if: {
after: false,
},

for: {
after: false,
},

while: {
after: false,
},

switch: {
after: false,
},
},
}],

"@stylistic/js/eol-last": ["error", "always"],

export default [{
...js.configs.recommended,
...playwright.configs["flat/recommended"],
ignores: ["test/e2e/test-results/**"],
files: ["*.js", "*.mjs", "test/e2e/**"],
"no-unused-vars": ["error", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
}],

rules: {
...playwright.configs["flat/recommended"].rules,
...sharedRules
"no-useless-escape": "off",
"no-cond-assign": "off",
"no-case-declarations": "off",
}

export default [
{
ignores: [
"test/e2e/test-results/",
"coverage/",
"cover/",
"priv/",
"deps/",
"doc/"
]
},
{
...js.configs.recommended,
files: ["*.js", "*.mjs", "test/e2e/**"],
ignores: ["assets/**"],

plugins: {
...playwright.configs["flat/recommended"].plugins,
"@stylistic/js": stylisticJs,
},

rules: {
...playwright.configs["flat/recommended"].rules,
...sharedRules
},
},
}]
{
...js.configs.recommended,

files: ["assets/**/*.js", "assets/**/*.mjs"],
ignores: ["test/e2e/**"],

plugins: {
jest,
"@stylistic/js": stylisticJs,
},

languageOptions: {
globals: {
...globals.browser,
...jest.environments.globals.globals,
global: "writable",
},

ecmaVersion: 12,
sourceType: "module",
},

rules: {
...sharedRules,
},
}]
60 changes: 0 additions & 60 deletions eslint.rules.mjs

This file was deleted.

17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@
"@babel/preset-env": "7.26.0",
"@eslint/js": "^9.18.0",
"@playwright/test": "^1.49.1",
"eslint-plugin-playwright": "^2.1.0",
"monocart-reporter": "^2.9.13",
"@stylistic/eslint-plugin-js": "^2.12.1",
"css.escape": "^1.5.1",
"eslint": "9.18.0",
"eslint-plugin-jest": "28.10.0",
"eslint-plugin-playwright": "^2.1.0",
"globals": "^15.14.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-monocart-coverage": "^1.1.1",
"monocart-reporter": "^2.9.13",
"phoenix": "1.7.18"
},
"scripts": {
Expand Down

0 comments on commit 62bd534

Please sign in to comment.