Cdr缓存的文件在哪里:ESLint缓存存储在哪里

我想知道更多关于 eslinting 缓存的细节。

eslintng 使用任何缓存机制?如果是,那么 windows 和 linux 上的缓存文件在哪里?

有没有办法在命令行上清理缓存?

是否有一个推荐的 eslinting 设置为 react-typescript 项目?

2

打开命令调色板( Ctrl + Shift + P )并执行 Reload Window 命令 (键入它直到它自动完成,按回车键)。请注意,它会重新加载任何终端 (我认为它基本上等同于关闭和重新打开 VS Code?)

对于eslint,没有推荐它更像你喜欢的,团队做的,建议像我一样使用极端eslint配置

.eslintrc.js

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,
  ],
  pr: '@typescript-eslint/pr', // Specifies the ESLint pr
  env: {
    node: true,
    browser: true,
    es6: true,
    jest: true,
  },
  prOptions: {
    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)"
      }
    ]
  },
};

.eslintignore

/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 package

package.json包

  "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"
  }
1

我的 eslint 缓存在我的 React TypeScript NX monorepos 中往往会过时。它会产生我的 IDE 中不存在的幻影 ESLint 警告。这是我用来查找它的命令。它通常埋在一些 node_modules 目录中。

$ find . -name ".eslintcache" -print
>> ./apps/my-app/node_modules/.cache/.eslintcache

本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处

(66)
Vivo s 15 pro:在Mac上将R连接到FilemakerPro15
上一篇
鲜柚生活小程序:Java小程序 vs应用程序
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(3条)