我想了解有关ESLinting缓存的更多详细信息。
mfpqipee1#
打开命令面板( Ctrl + Shift + P )并执行Reload Window命令(键入它直到它自动完成,按回车)。注意,它将重新加载任何终端(我认为这基本上相当于关闭并重新打开VS代码?)对于eslint,没有推荐,它更像是你喜欢的,团队做了,建议我真的使用了极端的eslint配置.eslintrc.js
( Ctrl + Shift + P )
eslint
module.exports = { root: true, extends: [ 'eslint:recommended', 'plugin:prettier/recommended', 'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react 'plugin:react-hooks/recommended', 'plugin:@typescript-eslint/eslint-recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin 'prettier', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier, ], parser: '@typescript-eslint/parser', // Specifies the ESLint parser env: { node: true, browser: true, es6: true, jest: true, }, parserOptions: { ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features sourceType: 'module', // Allows for the use of imports ecmaFeatures: { jsx: true, // Allows for the parsing of JSX arrowFunctions: true, }, }, plugins: ['react', '@typescript-eslint', 'prettier'], settings: { react: { version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use }, 'import/resolver': { node: { extensions: ['.js', '.jsx', '.ts', '.tsx'], paths: ['./src'], }, }, }, rules: { // Existing rules 'comma-dangle': 'off', // https://eslint.org/docs/rules/comma-dangle 'function-paren-newline': 'off', // https://eslint.org/docs/rules/function-paren-newline 'global-require': 'off', // https://eslint.org/docs/rules/global-require 'import/no-dynamic-require': 'off', // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md 'no-inner-declarations': 'off', // https://eslint.org/docs/rules/no-inner-declarations // New rules 'class-methods-use-this': 'off', 'import/extensions': 'off', 'import/prefer-default-export': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/no-var-requires': 'off', 'react/prop-types': 'off', '@typescript-eslint/ban-ts-ignore': 'off', '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-empty-function': 'off', 'react/react-in-jsx-scope': 'off', // not needed anymore from react 17 "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": [ "warn", { "additionalHooks": "(useRecoilCallback|useRecoilTransaction_UNSTABLE)" } ] }, };
.已忽略
/node_modules/** /public/** /build/**
tsconfig.json
{ "compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, "noUnusedParameters": true, "baseUrl": "./" }, "include": ["src/**/*", "@types"] }
// There is too many additional packages if you don't need them just delete that packagepackage.json
// There is too many additional packages if you don't need them just delete that package
"devDependencies": { "@babel/core": "^7.16.7", "@types/jest": "^27.4.0", "@types/node": "^17.0.8", "@types/react": "^17.0.38", "@types/react-dom": "^17.0.11", "@types/react-lazy-load-image-component": "^1.5.2", "@typescript-eslint/eslint-plugin": "^5.9.0", "autoprefixer": "^10.4.2", "env-cmd": "^10.1.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.25.4", "eslint-plugin-jest": "^25.3.4", "eslint-plugin-json": "^3.1.0", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-react": "^7.28.0", "eslint-plugin-react-hooks": "^4.3.0", "husky": "^7.0.4", "lint-staged": "^12.1.7", "postcss": "^8.4.5", "prettier": "^2.5.1", "prettier-eslint": "^13.0.0", "pretty-quick": "^3.1.3", "tailwindcss": "^3.0.12", "typescript": "^4.5.4" }
06odsfpq2#
我的eslint缓存在我的React TypeScript NX monorepos中往往会过时。它会产生在我的IDE中不存在的幻像ESLint警告。这是我用来找到它的命令。它通常隐藏在某个node_modules目录中。
$ find . -name ".eslintcache" -print >> ./apps/my-app/node_modules/.cache/.eslintcache
2条答案
按热度按时间mfpqipee1#
打开命令面板
( Ctrl + Shift + P )
并执行Reload Window命令(键入它直到它自动完成,按回车)。注意,它将重新加载任何终端(我认为这基本上相当于关闭并重新打开VS代码?)对于
eslint
,没有推荐,它更像是你喜欢的,团队做了,建议我真的使用了极端的eslint
配置.eslintrc.js
.已忽略
tsconfig.json
// There is too many additional packages if you don't need them just delete that package
package.json
06odsfpq2#
我的eslint缓存在我的React TypeScript NX monorepos中往往会过时。它会产生在我的IDE中不存在的幻像ESLint警告。这是我用来找到它的命令。它通常隐藏在某个node_modules目录中。