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

Chore(next): Include react specific eslint v9 rules #852

Merged
merged 3 commits into from
Nov 22, 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
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