Skip to content

Commit

Permalink
chore: upgrade eslint to version 9
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas committed Dec 4, 2024
1 parent cab08a5 commit fa45624
Show file tree
Hide file tree
Showing 33 changed files with 2,382 additions and 2,355 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

42 changes: 0 additions & 42 deletions .eslintrc.cjs

This file was deleted.

116 changes: 116 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import eslint from "@eslint/js"
import tsParser from "@typescript-eslint/parser"
import formatjs from "eslint-plugin-formatjs"
import playwright from "eslint-plugin-playwright"
import pluginPromise from "eslint-plugin-promise"
import react from "eslint-plugin-react"
import reactHooks from "eslint-plugin-react-hooks"
import storybook from "eslint-plugin-storybook"
import tsdoc from "eslint-plugin-tsdoc"
import globals from "globals"
import tseslint from "typescript-eslint"

const config = tseslint.config([
{
ignores: [
"**/assets/*.js",
"!.storybook",
"**/dist/**",
"**/storybook-static/**",
"babel.config.js",
"eslint.config.mjs",
"examples/nextjs-spa/**", // This project is not maintained
],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
pluginPromise.configs["flat/recommended"],
storybook.configs["flat/recommended"],
{
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
{
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
plugins: {
react,
"react-hooks": reactHooks,
tsdoc,
formatjs,
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
},

parser: tsParser,
ecmaVersion: 2021,
sourceType: "module",

parserOptions: {
tsconfigRootDir: "./",

ecmaFeatures: {
jsx: true,
},
},
},

rules: {
...reactHooks.configs.recommended.rules,
"tsdoc/syntax": "warn",
"formatjs/no-offset": "error",
"@typescript-eslint/no-floating-promises": "error",
// The legacy elements is written with lots of any types
"no-unused-vars": "off",
"no-undef": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"react/prop-types": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",

"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],

"no-extra-semi": "off",
},
},
{
files: ["src/**/*.spec.ts"],
...playwright.configs["flat/recommended"],
rules: {
...playwright.configs["flat/recommended"].rules,
"no-empty-pattern": "off",
},
},
])

export default config
4 changes: 0 additions & 4 deletions examples/nextjs-spa/.eslintrc.json

This file was deleted.

5 changes: 2 additions & 3 deletions examples/nextjs-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
"dev": "NODE_OPTIONS='--inspect' next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"debug": "playwright test --ui"
},
"dependencies": {
"@next/font": "13.4.13",
"next": "14.2.10",
"next": "15.0.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
Expand All @@ -22,7 +21,7 @@
"@types/node": "18.16.19",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"eslint-config-next": "13.1.5",
"eslint-config-next": "15.0.3",
"typescript": "5.2.2",
"vite": "5.4.10"
}
Expand Down
File renamed without changes.
Loading

0 comments on commit fa45624

Please sign in to comment.