Closed arlukin closed 2 years ago
This is what we use on some frontend projects. You probably doesn't need all of it. So pick what is needed.
"devDependencies": { "@vitejs/plugin-react-refresh": "^1.3.5", "eslint": "^7.30.0", "eslint-config-airbnb-base": "^14.2.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-html": "^6.1.2", "eslint-plugin-import": "^2.23.4", "eslint-plugin-jest": "^24.3.6", "eslint-plugin-markdown": "^2.2.0", "eslint-plugin-mdx": "^1.13.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-react": "^7.24.0", "husky": "^7.0.1", "jest": "^27.0.6", "nodemon": "^2.0.9", "nyc": "^15.1.0", "prettier": "^2.3.2", "rollup-plugin-visualizer": "^5.5.1", "syncpack": "^5.7.11", "syncyarnlock": "^1.0.19", "vite": "^2.4.1", "vite-plugin-radar": "^0.2.0" },
.eslintignore
/coverage /dist /node_modules
.eslintrc.json
{ "root": true, "plugins": ["jest", "node", "react", "markdown", "import"], "extends": [ "eslint:recommended", "airbnb-base", "plugin:jest/recommended", "plugin:node/recommended", "plugin:markdown/recommended", "plugin:react/recommended", "plugin:import/react", "plugin:import/errors", "plugin:mdx/recommended", "prettier" ], "env": { "browser": true, "commonjs": true, "es2021": true, "node": true, "jest": true }, "parserOptions": { "ecmaVersion": 12, "sourceType": "module", "ecmaFeatures": { "jsx": true } }, "rules": { "no-console": 0, "indent": ["error", 2, { "SwitchCase": 1 }], "linebreak-style": ["error", "unix"], "quote-props": ["error", "consistent"], "semi": ["error", "always"], "react/prop-types": 0, "node/no-unsupported-features/es-syntax": ["error", { "ignores": ["modules"] }], "no-unused-vars": ["error", { "argsIgnorePattern": "props" }], "node/no-missing-import": [ "error", { "tryExtensions": [".js", ".jsx", ".ts", ".tsx"] } ], "import/prefer-default-export": "off", "no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"] }, "overrides": [ { "files": ["*.mdx"], "extends": "plugin:mdx/recommended", "parser": "eslint-mdx", "rules": { "react/jsx-no-undef": 0, "react/no-unescaped-entities": "off", "semi": ["error", "never"], "indent": "off", "no-undef": "off", "no-unused-vars": "off", "no-console": "off", "no-unused-expressions": "off", "import/no-extraneous-dependencies": "off", "import/no-unresolved": "off", "node/no-extraneous-require": "off", "node/no-missing-require": "off", "node/no-unpublished-require": "off" } } ], "settings": { "react": { "createClass": "createReactClass", // Regex for Component Factory to use, // default to "createReactClass" "pragma": "React", // Pragma to use, default to "React" "version": "detect", // React version. "detect" automatically picks the version you have installed. // You can also use `16.0`, `16.3`, etc, if you want to override the detected value. // default to latest and warns if missing // It will default to "detect" in the future "flowVersion": "0.53" // Flow version }, "propWrapperFunctions": [ // The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped. "forbidExtraProps", { "property": "freeze", "object": "Object" }, { "property": "myFavoriteWrapper" } ], "linkComponents": [ // Components used as alternatives to <a> for linking, eg. <Link to={ url } /> "Hyperlink", { "name": "Link", "linkAttribute": "to" } ], "import/resolver": { "node": { "extensions": [".js", ".jsx", ".ts", ".tsx"] } }, "mdx/code-blocks": true, // optional, if you want to disable language mapper, set it to `false` // if you want to override the default language mapper inside, you can provide your own "mdx/language-mapper": {} }, "ignorePatterns": ["vite.config.ts.js"] }
You used some other eslint configuration than the airbnb-base we are using for other repositories. That is ok for now, especially for this repo. We keep the issue for future standardization.
This is what we use on some frontend projects. You probably doesn't need all of it. So pick what is needed.
.eslintignore
.eslintrc.json