Skip to content

Commit

Permalink
fix(eslintv9): include and apply eslint react rules and eslint-config…
Browse files Browse the repository at this point in the history
…-typescript-react
  • Loading branch information
ahennr committed Nov 22, 2024
1 parent f4f67d2 commit 14aceb8
Show file tree
Hide file tree
Showing 51 changed files with 1,689 additions and 3,224 deletions.
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# diasble CI
# disable CI
[ -n "$CI" ] && exit 0

npx --no-install commitlint --edit $1
5 changes: 2 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ module.exports = {
'@babel/preset-react'
],
plugins: [
'@babel/transform-class-properties',
'@babel/proposal-object-rest-spread',
'@babel/proposal-optional-chaining',
'@babel/plugin-transform-optional-chaining',
['@babel/plugin-transform-class-properties', { loose: false }],
[
'import',
{
Expand Down
34 changes: 28 additions & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// @ts-check
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import importPlugin from 'eslint-plugin-import';
import eslintReact from 'eslint-plugin-react';
import eslintTerrestris from '@terrestris/eslint-config-typescript';
import eslintReactTerrestris from '@terrestris/eslint-config-typescript-react';
import eslint from '@eslint/js';
import tsEslint from 'typescript-eslint';
import stylisticEslint from '@stylistic/eslint-plugin'
Expand All @@ -14,28 +17,47 @@ export default tsEslint.config({
importPlugin.flatConfigs.recommended
],
files: [
'**/*.ts'
'**/*.{ts,tsx}',
],
ignores: [
'**/*.spec.ts',
'**/jest/__mocks__/*.ts'
'**/test/setup.ts',
'**/e2e-tests/**.ts',
'**/global-setup.ts',
'**/playwright.config.ts',
'**/*.spec.{ts,tsx}',
'coverage/**/*.{js,ts*}',
'dist/**/*.{js,ts*}'
],
settings: {
react: {
version: 'detect'
}
},
languageOptions: {
ecmaVersion: 2022,
globals: globals.browser,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname
},
}
},
plugins: {
'@stylistic': stylisticEslint
'react-hooks': reactHooks,
'@stylistic': stylisticEslint,
react: eslintReact,
'@typescript-eslint/eslint-plugin': tsEslint
},
rules: {
...eslintTerrestris.rules,
'@typescript-eslint/member-ordering': 'off',
...eslintReactTerrestris.rules,
...reactHooks.configs.recommended.rules,
'react/jsx-closing-tag-location': ['warn'],
'react/jsx-closing-bracket-location': ['warn'],
'react-hooks/rules-of-hooks': ['warn'],
'react-hooks/exhaustive-deps': ['warn'],
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'import/no-named-as-default': 'off',
'import/no-unresolved': 'off',
'import/named': 'off',
'import/order': ['warn', {
Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = {
'^.+\\.tsx?$': 'babel-jest'
},
moduleNameMapper: {
// eslint-disable-next-line max-len
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/test/__mocks__/fileMock.js',
'\\.(css|less|scss)$': '<rootDir>/test/__mocks__/styleMock.js',
'shogunApplicationConfig': '<rootDir>/assets/fallbackConfig.js'
Expand Down
Loading

0 comments on commit 14aceb8

Please sign in to comment.