Skip to content

Commit

Permalink
fix(create-vite): fix eslint configuration for React templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Jul 8, 2023
1 parent 8f109a6 commit a0c06a1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions packages/create-vite/template-react-ts/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-env node */

module.exports = {
root: true,
env: { browser: true, es2020: true },
Expand All @@ -9,11 +7,12 @@ module.exports = {
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
plugins: ['react-refresh'],
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/create-vite/template-react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/* eslint-env node */

module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
Expand Down

0 comments on commit a0c06a1

Please sign in to comment.