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

spike: get eslint v9 working #235

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 0 additions & 4 deletions .eslintrc

This file was deleted.

75 changes: 0 additions & 75 deletions .eslintrc.base

This file was deleted.

80 changes: 80 additions & 0 deletions eslint.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import typescriptParser from '@typescript-eslint/parser';
import globals from 'globals';

export const eslintBaseConfig = {
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
modules: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
},
},
rules: {
// '@typescript-eslint/consistent-type-imports': 'warn',
// '@typescript-eslint/explicit-module-boundary-types': 'off',
// '@typescript-eslint/no-shadow': 'off',
// '@typescript-eslint/no-unused-vars': 'warn',
'class-methods-use-this': 'off',
'comma-dangle': ['error', 'always-multiline'],
curly: 1,
// 'import/extensions': 'off',
// 'import/no-default-export': 'error',
// 'import/no-extraneous-dependencies': 'off',
// 'import/no-unresolved': 0,
// 'import/prefer-default-export': 'off',
indent: 'off',
'jsx-quotes': ['error', 'prefer-double'],
'linebreak-style': 'off',
'max-len': 'off',
'newline-per-chained-call': 'off',
'no-bitwise': 'off',
'no-console': [
'error',
{
allow: ['warn', 'error'],
},
],
'no-continue': 'off',
'no-implicit-any-catch': 'off',
'no-nested-ternary': 'off',
'no-param-reassign': 'off',
'no-plusplus': 'off',
'no-restricted-syntax': 'off',
'no-shadow': 'off',
'no-unused-expressions': 'warn',
'no-unused-vars': 'off',
'no-var': 'warn',
'object-curly-newline': 'off',
'prettier/prettier': 'error',
'react/function-component-definition': 'off',
// 'react/jsx-filename-extension': [
// 1,
// {
// extensions: ['.ts', '.tsx'],
// },
// ],
'react/jsx-one-expression-per-line': 'off',
'react/jsx-props-no-spreading': 'off',
'react/jsx-uses-react': 'off',
'react/prop-types': 0,
'react/react-in-jsx-scope': 'off',
'react/require-default-props': 'off',
quotes: [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
},
};
19 changes: 19 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// import { FlatCompat } from '@eslint/eslintrc';
import { eslintBaseConfig } from './eslint.config.base.js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

// set up for compat.extends('') - this can be used to add config in a legacy style.
// import * as path from 'path';
// import { fileURLToPath } from 'url';
//
// const __filename = fileURLToPath(import.meta.url);
// const __dirname = path.dirname(__filename);
// const compat = new FlatCompat({ resolvePluginsRelativeTo: __dirname });

export default [
eslintPluginPrettierRecommended,
eslintBaseConfig,
{
files: ['src/**/*.{ts,tsx}'],
},
];
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"globals": "^15.0.0",
"husky": "^9.0.11",
"lerna": "8.1.2",
"lint-staged": "^15.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"check:types": "tsc --noEmit",
"check:circular-deps": "madge --circular $(find ./src -name '*.ts' -o -name '*.tsx')",
"check:circular-deps-graph": "madge --circular $(find ./src -name '*.ts' -o -name '*.tsx') --image graph.svg",
"lint": "eslint --ext .tsx --ext .ts ./src",
"lint": "eslint -c ../../eslint.config.js ./src",
"pre-commit:validate": "yarn lint --fix",
"pre-push:validate": "yarn check:types & yarn check:circular-deps"
},
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12791,6 +12791,13 @@ __metadata:
languageName: node
linkType: hard

"globals@npm:^15.0.0":
version: 15.0.0
resolution: "globals@npm:15.0.0"
checksum: 10/f2f927fe457a5ed2c27b00b77ca22ec31fe5624aac2da178e228a5bcc9928df0f1853e79d6499e04283d184ea13e26cc8127e890098490c9fee616363cdf0d76
languageName: node
linkType: hard

"globalthis@npm:^1.0.3":
version: 1.0.3
resolution: "globalthis@npm:1.0.3"
Expand Down Expand Up @@ -18533,6 +18540,7 @@ __metadata:
eslint-plugin-prettier: "npm:^5.1.3"
eslint-plugin-react: "npm:^7.34.1"
eslint-plugin-react-hooks: "npm:^4.6.0"
globals: "npm:^15.0.0"
husky: "npm:^9.0.11"
lerna: "npm:8.1.2"
lint-staged: "npm:^15.2.2"
Expand Down