Last active
February 7, 2024 17:18
-
-
Save Hi7cl4w/589b9bbef272f6772dd190b0773a1a79 to your computer and use it in GitHub Desktop.
eslint react boilerplate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| root: true, | |
| env: { browser: true, es2020: true }, | |
| extends: [ | |
| 'eslint:recommended', | |
| 'plugin:import/recommended', | |
| 'plugin:import/typescript', | |
| 'plugin:react/recommended', | |
| 'plugin:jsx-a11y/recommended', | |
| 'plugin:react-hooks/recommended', | |
| 'plugin:@typescript-eslint/recommended', | |
| 'plugin:@typescript-eslint/recommended-requiring-type-checking', | |
| 'plugin:@tanstack/eslint-plugin-query/recommended', | |
| 'prettier', | |
| ], | |
| ignorePatterns: ['dist', '.eslintrc.cjs'], | |
| parser: '@typescript-eslint/parser', | |
| parserOptions: { | |
| ecmaVersion: 2022, | |
| sourceType: 'module', | |
| project: './tsconfig.json', | |
| ecmaFeatures: { | |
| jsx: true, | |
| }, | |
| }, | |
| plugins: [ | |
| 'react-refresh', | |
| 'react', | |
| 'import', | |
| 'jsx-a11y', | |
| '@typescript-eslint', | |
| '@tanstack/query', | |
| ], | |
| rules: { | |
| 'react/prop-types': 0, | |
| 'react/react-in-jsx-scope': 0, | |
| '@typescript-eslint/no-empty-function': 0, | |
| 'react-refresh/only-export-components': [ | |
| 'warn', | |
| { allowConstantExport: true }, | |
| ], | |
| '@tanstack/query/exhaustive-deps': 'error', | |
| '@tanstack/query/no-rest-destructuring': 'warn', | |
| '@tanstack/query/stable-query-client': 'error', | |
| }, | |
| settings: { | |
| react: { | |
| version: 'detect', | |
| }, | |
| 'import/parsers': { | |
| '@typescript-eslint/parser': ['.ts', '.tsx'], | |
| }, | |
| 'import/resolver': { | |
| typescript: true, | |
| node: { | |
| extensions: ['.js', '.jsx', '.ts', '.tsx'], | |
| }, | |
| alias: { | |
| map: [['', './public']], | |
| }, | |
| }, | |
| }, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "extends": [ | |
| "eslint:recommended", | |
| "plugin:import/errors", | |
| "plugin:react/recommended", | |
| "plugin:jsx-a11y/recommended", | |
| "plugin:react-hooks/recommended", | |
| "prettier" | |
| ], | |
| "plugins": [ | |
| "react", | |
| "import", | |
| "jsx-a11y" | |
| ], | |
| "rules": { | |
| "react/prop-types": 0, | |
| "react/react-in-jsx-scope": 0 | |
| }, | |
| "parserOptions": { | |
| "ecmaVersion": 2022, | |
| "sourceType": "module", | |
| "ecmaFeatures": { | |
| "jsx": true | |
| } | |
| }, | |
| "env": { | |
| "es6": true, | |
| "browser": true, | |
| "node": true | |
| }, | |
| "settings": { | |
| "react": { | |
| "version": "detect" | |
| }, | |
| "import/resolver": { | |
| "node": { | |
| "extensions": [ | |
| ".js", | |
| ".jsx", | |
| ".ts", | |
| ".tsx" | |
| ] | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "extends": [ | |
| "eslint:recommended", | |
| "plugin:import/errors", | |
| "plugin:react/recommended", | |
| "plugin:jsx-a11y/recommended", | |
| "plugin:react-hooks/recommended", | |
| "plugin:@typescript-eslint/recommended", | |
| "plugin:@typescript-eslint/recommended-requiring-type-checking", | |
| "prettier" | |
| ], | |
| "rules": { | |
| "react/prop-types": 0, | |
| "react/react-in-jsx-scope": 0, | |
| "@typescript-eslint/no-empty-function": 0 | |
| }, | |
| "plugins": ["react", "import", "jsx-a11y", "@typescript-eslint"], | |
| "parser": "@typescript-eslint/parser", | |
| "parserOptions": { | |
| "ecmaVersion": 2022, | |
| "sourceType": "module", | |
| "project": "./tsconfig.json", | |
| "ecmaFeatures": { | |
| "jsx": true | |
| } | |
| }, | |
| "env": { | |
| "es6": true, | |
| "browser": true, | |
| "node": true | |
| }, | |
| "settings": { | |
| "react": { | |
| "version": "detect" | |
| }, | |
| "import/parsers": { | |
| "@typescript-eslint/parser": [".ts", ".tsx"] | |
| }, | |
| "import/resolver": { | |
| "typescript": { | |
| "alwaysTryTypes": true | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm i -D eslint eslint-config-prettier eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks prettier eslint-plugin-import | |
| // typescript | |
| npm install -D eslint-import-resolver-typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "eslint": "^8.28.0", | |
| "eslint-config-prettier": "^8.5.0", | |
| "eslint-plugin-import": "^2.26.0", | |
| "eslint-plugin-jsx-a11y": "^6.6.1", | |
| "eslint-plugin-react": "^7.31.11", | |
| "eslint-plugin-react-hooks": "^4.6.0", | |
| "prettier": "^2.7.1", | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment