Skip to content

Commit

Permalink
Update eslint.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
elPandaFriki authored Oct 17, 2024
1 parent 1dc73b2 commit a6d38a0
Showing 1 changed file with 99 additions and 78 deletions.
177 changes: 99 additions & 78 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,93 +1,114 @@
import react from 'eslint-plugin-react'
import reactRefresh from 'react-refresh'
import eslint from '@eslint/js';
import jestPlugin from 'eslint-plugin-jest';
import tseslint from 'typescript-eslint'
import globals from 'globals'

export default [
...tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
);
{
languageOptions: {
parserOptions: {
tsconfigRootDir: "./",
}
},
rules: {
"typescript-eslint/consistent-type-imports": [
2,
{
fixStyle: "separate-type-imports"
}
export default tseslint.config(
{
root: true,
ignores: [
"**/node_modules/**",
"**/dist/**",
"**/build/**",
"**/scripts/**"
],
}
// BASIC ESLINT AND TYPESCRIPT
eslint.configs.recommended,
...tseslint.configs.recommended,
{
plugins: {
'@typescript-eslint': tseslint.plugin
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"typescript-eslint/no-restricted-imports": [
2,
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: "./",
}
},
rules: {
"typescript-eslint/consistent-type-imports": [
2,
{
fixStyle: "separate-type-imports"
}
],
"typescript-eslint/no-restricted-imports": [
2,
{
paths: [
{
name: "react-redux",
importNames: [
"useSelector",
"useStore",
"useDispatch"
],
message: "Please use pre-typed versions from `src/app/hooks.ts` instead."
}
]
}
]
},
},
// TESTING
{
..jestPlugin.configs['flat/recommended'],
plugins: {
jest: jestPlugin
},
overrides: [
{
paths: [
{
name: "react-redux",
importNames: [
"useSelector",
"useStore",
"useDispatch"
],
message: "Please use pre-typed versions from `src/app/hooks.ts` instead."
}
]
files: ["*{test,spec}.{t,j}s?(x)"],
env: {
jest: true
}
}
]
}
// JAVASCRIPT
{
files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
},
},
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
...reactPlugin.configs.flat.recommended,
},
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
globals: {
...globals.browser,
...globals.node,
...globals.serviceworker
},
extends: [
"eslint:recommended",
"plugin:react/jsx-runtime",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"prettier"
],
root: true,
ignorePatterns: [
"node_modules",
"dist",
"build",
"scripts"
],
languageOptions: {
parserOptions: {
project: true,
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true
// REACT
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
...reactPlugin.configs.flat.recommended,
globals: {
...globals.browser,
...globals.node,
...globals.serviceworker
},
extends: [
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
],
languageOptions: {
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true
}
}
}
},
plugins: {
reactRefresh
},
overrides: [
{
files: ["*.{c,m,}{t,j}s", "*.{t,j}sx"]
},
{
files: ["*{test,spec}.{t,j}s?(x)"],
env: {
jest: true
plugins: {
reactRefresh
},
overrides: [
{
files: ["*.{c,m,}{t,j}s", "*.{t,j}sx"]
}
}
]
}
]
}
)
]

0 comments on commit a6d38a0

Please sign in to comment.