Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ESLint #581

Merged
merged 3 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .eslintignore

This file was deleted.

49 changes: 0 additions & 49 deletions .eslintrc.js

This file was deleted.

81 changes: 81 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import js from '@eslint/js'
import ts from 'typescript-eslint'

import reactPlugin from 'eslint-plugin-react'
import reactHooksPlugin from 'eslint-plugin-react-hooks'
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'

export default ts.config(
{
ignores: [
// Babel plugin fixtures aren't fully valid
'src/plugin-babel/__fixtures__',

// Deps
'node_modules',

// Build/Compile output
'storybook-static',
'dist',
'types',
],
},
js.configs.recommended,
ts.configs.recommended,
ts.configs.recommendedTypeChecked,

/** Required for type checking */
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
// ts.configs.strictTypeChecked,
// ts.configs.stylisticTypeChecked,

/** Disable TS rules outside TS context */
{
files: ['**/*.js', '**/*.mjs'],
extends: [ts.configs.disableTypeChecked],
},

/** Disable rules related to using any until types don't use any */
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
},
},
{
rules: {
// Componentry uses empty interfaces frequently for module augmentation
'@typescript-eslint/no-empty-object-type': ['error', { allowInterfaces: 'always' }],
},
},

reactPlugin.configs.flat.recommended, // This is not a plugin object, but a shareable config object
reactPlugin.configs.flat['jsx-runtime'], // Add this if you are using React 17+
{
settings: {
react: {
version: 'detect',
},
},
},

{
plugins: {
'react-hooks': reactHooksPlugin,
},
rules: reactHooksPlugin.configs.recommended.rules,
},

jsxA11yPlugin.flatConfigs.recommended,
)
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"babel:watch": "BABEL_ENV=browser babel src --watch --out-dir dist/browser --ignore '**/*.spec.js'",
"build-storybook": "storybook build",
"test": "pnpm run test:lint && pnpm run test:types && pnpm run test:unit",
"test:lint": "eslint --format=pretty .",
"test:lint": "eslint src/**",
"test:types": "tsc",
"pretest:unit": "pnpm run compile",
"test:unit": "vitest run",
Expand Down Expand Up @@ -80,6 +80,7 @@
"@babel/core": "7.23.2",
"@babel/plugin-transform-runtime": "7.23.2",
"@babel/preset-typescript": "7.23.2",
"@eslint/js": "9.17.0",
"@storybook/addon-essentials": "7.5.1",
"@storybook/addon-links": "7.5.1",
"@storybook/addon-mdx-gfm": "^7.5.1",
Expand All @@ -96,23 +97,20 @@
"@types/babel__core": "7.20.5",
"@types/react": "18.2.31",
"@types/react-dom": "18.2.14",
"@typescript-eslint/eslint-plugin": "6.8.0",
"@typescript-eslint/parser": "6.8.0",
"@vitejs/plugin-react": "4.3.4",
"@vitest/coverage-v8": "2.1.8",
"autoprefixer": "10.4.16",
"babel-plugin-tester": "11.0.4",
"chromatic": "7.4.0",
"css-loader": "7.1.2",
"eslint": "8.52.0",
"eslint-config-eloquence": "23.1.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-prettier": "5.0.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-testing-library": "6.1.0",
"eslint": "9.17.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-react-hooks": "5.1.0",
"eslint-plugin-storybook": "0.11.1",
"eslint-plugin-testing-library": "7.1.1",
"node-notifier": "10.0.1",
"postcss": "8.4.31",
"postcss-loader": "8.1.1",
Expand All @@ -124,6 +122,7 @@
"tailwindcss": "3.3.3",
"typedoc": "0.27.5",
"typescript": "5.7.2",
"typescript-eslint": "^8.18.1",
"vitest": "2.1.8",
"webpack": "5.89.0"
}
Expand Down
Loading
Loading