diff --git a/.gitignore b/.gitignore index 3e5bc5de9..729dd9e63 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ stats.json coverage storybook-static .build_cache +.eslintcache diff --git a/package.json b/package.json index 788827b1a..05cc554ba 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "test": "jest --maxWorkers=50% --coverage=true", "test:ci": "jest --maxWorkers=50%", "eslint": "npm-run-all eslint:check", - "eslint:check": "eslint --ext .ts,.tsx,.js ./src/", - "eslint:apply": "eslint --ext .ts,.tsx,.js --fix ./src/", + "eslint:check": "eslint --cache --ext .ts,.tsx,.js ./src/", + "eslint:apply": "eslint --cache --ext .ts,.tsx,.js --fix ./src/", "license:check": "license-check-and-add check -f license-config.json", "license:apply": "license-check-and-add add -f license-config.json", "lint": "npm-run-all -l -p format eslint", @@ -54,6 +54,7 @@ "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-unused-imports": "^2.0.0", + "eslint-webpack-plugin": "^3.2.0", "file-loader": "^6.2.0", "fork-ts-checker-webpack-plugin": "^7.3.0", "html-webpack-plugin": "^5.5.0", diff --git a/tsconfig.json b/tsconfig.json index 63d9aaca6..d50814052 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,11 +25,11 @@ } }, "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.jsx", - "**/*.js", - "**/*.json" + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.jsx", + "src/**/*.js", + "src/**/*.json" ], - "exclude": ["node_modules"] + "exclude": ["node_modules", "dist"] } diff --git a/webpack.dev.js b/webpack.dev.js index 7cdb537e7..3e45eda1a 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -2,6 +2,7 @@ const path = require('path'); const { merge } = require('webpack-merge'); const common = require('./webpack.common.js'); const DotenvPlugin = require('dotenv-webpack'); +const ESLintPlugin = require('eslint-webpack-plugin'); const HOST = process.env.HOST || "localhost"; const PORT = process.env.PORT || "9000"; @@ -19,6 +20,12 @@ module.exports = merge(common('development'), { }, plugins: [ new DotenvPlugin(), + new ESLintPlugin({ + cache: true, + cacheLocation: path.resolve(__dirname, '.eslintcache'), + extensions: ['js', 'jsx', 'ts', 'tsx'], + exclude: ['node_modules', 'dist'], + }), ], module: { rules: [ diff --git a/yarn.lock b/yarn.lock index 62b1a50d3..83658f3d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1334,7 +1334,7 @@ __metadata: languageName: node linkType: hard -"@types/eslint@npm:*": +"@types/eslint@npm:*, @types/eslint@npm:^7.29.0 || ^8.4.1": version: 8.4.10 resolution: "@types/eslint@npm:8.4.10" dependencies: @@ -3389,6 +3389,7 @@ __metadata: eslint-plugin-react: ^7.32.2 eslint-plugin-react-hooks: ^4.6.0 eslint-plugin-unused-imports: ^2.0.0 + eslint-webpack-plugin: ^3.2.0 file-loader: ^6.2.0 fork-ts-checker-webpack-plugin: ^7.3.0 html-webpack-plugin: ^5.5.0 @@ -4685,6 +4686,22 @@ __metadata: languageName: node linkType: hard +"eslint-webpack-plugin@npm:^3.2.0": + version: 3.2.0 + resolution: "eslint-webpack-plugin@npm:3.2.0" + dependencies: + "@types/eslint": ^7.29.0 || ^8.4.1 + jest-worker: ^28.0.2 + micromatch: ^4.0.5 + normalize-path: ^3.0.0 + schema-utils: ^4.0.0 + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + webpack: ^5.0.0 + checksum: 095034c35e773fdb21ec7e597ae1f8a6899679c290db29d8568ca94619e8c7f4971f0f9edccc8a965322ab8af9286c87205985a38f4fdcf17654aee7cd8bb7b5 + languageName: node + linkType: hard + "eslint@npm:^8.33.0": version: 8.33.0 resolution: "eslint@npm:8.33.0" @@ -7166,6 +7183,17 @@ __metadata: languageName: node linkType: hard +"jest-worker@npm:^28.0.2": + version: 28.1.3 + resolution: "jest-worker@npm:28.1.3" + dependencies: + "@types/node": "*" + merge-stream: ^2.0.0 + supports-color: ^8.0.0 + checksum: e921c9a1b8f0909da9ea07dbf3592f95b653aef3a8bb0cbcd20fc7f9a795a1304adecac31eecb308992c167e8d7e75c522061fec38a5928ace0f9571c90169ca + languageName: node + linkType: hard + "jest-worker@npm:^29.1.2": version: 29.3.1 resolution: "jest-worker@npm:29.3.1" @@ -7780,7 +7808,7 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.0, micromatch@npm:^4.0.2, micromatch@npm:^4.0.4": +"micromatch@npm:^4.0.0, micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5": version: 4.0.5 resolution: "micromatch@npm:4.0.5" dependencies: