{"id":19268719,"url":"https://github.com/flingyp/lint-config","last_synced_at":"2025-04-11T18:41:53.508Z","repository":{"id":65643138,"uuid":"595961836","full_name":"flingyp/lint-config","owner":"flingyp","description":"ESLint and Stylelint Config of flingyp","archived":false,"fork":false,"pushed_at":"2025-03-19T05:34:38.000Z","size":447,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T14:39:04.642Z","etag":null,"topics":["config","configs","eslint","eslint-config","eslint-config-airbnb","eslint-plugin","eslint-plugin-vue","monorepo","tool"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flingyp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-02-01T06:59:30.000Z","updated_at":"2025-03-19T05:34:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"8698fe12-cc07-4e78-8f06-522c5b34fb82","html_url":"https://github.com/flingyp/lint-config","commit_stats":null,"previous_names":["flingyp/lint-config"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flingyp%2Flint-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flingyp%2Flint-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flingyp%2Flint-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flingyp%2Flint-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flingyp","download_url":"https://codeload.github.com/flingyp/lint-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248460835,"owners_count":21107555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","configs","eslint","eslint-config","eslint-config-airbnb","eslint-plugin","eslint-plugin-vue","monorepo","tool"],"created_at":"2024-11-09T20:17:09.541Z","updated_at":"2025-04-11T18:41:53.486Z","avatar_url":"https://github.com/flingyp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @flypeng/lint-config\n\n![@flypeng/eslint-config](https://img.shields.io/npm/v/%40flypeng%2Feslint-config?style=plastic\u0026logo=npm\u0026label=%40flypeng%2Feslint-config\u0026link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40flypeng%2Feslint-config) ![@flypeng/stylelint-config](https://img.shields.io/npm/v/%40flypeng%2Fstylelint-config?style=plastic\u0026logo=npm\u0026label=%40flypeng%2Fstylelint-config\u0026link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40flypeng%2Fstylelint-config)\n\n**English** | [简体中文](https://github.com/flingyp/lint-config/blob/main/README.zh-CN.md)\n\n- Single quotes, Semi\n- Share ESLint and Stylelint configurations\n- Code lint check based on Airbnb\n- Code formatting based on Prettier\n- [ESLint Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily\n- Easy to integrate, configuration, and custom rules\n\n## 📦 Packages\n\n- `@flypeng/eslint-config`\n  - `@flypeng/eslint-config-basic`\n  - `@flypeng/eslint-config-javascript`\n  - `@flypeng/eslint-config-typescript`\n  - `@flypeng/eslint-config-vue`\n  - `@flypeng/eslint-config-react`\n  - `@flypeng/eslint-config-other`\n- `@flypeng/stylelint-config`\n\n## 🏃 Integration\n\n### Install packages\n\n`pnpm add eslint stylelint prettier @flypeng/eslint-config @flypeng/stylelint-config -D`\n\n### Config `.eslintrc` or `eslint.config.js`、`.stylelintrc`\n\n#### `.eslintrc` (ESLint \u003c 9 \u0026\u0026 Disable eslint new configuration)\n\n```json\n{\n  \"extends\": \"@flypeng/eslint-config\"\n}\n```\n\n#### `eslint.config.js` (ESLint \u003e 9 \u0026\u0026 Enable eslint new configuration)\n\nWith ESM\n\n- `\"type\": \"module\"` in `package.json`\n\n```js\n// eslint.config.js\nimport flypeng from '@flypeng/eslint-config';\n\nexport default flypeng();\n```\n\nWith CJS\n\n```js\n// eslint.config.js\nconst flypeng = require('@flypeng/eslint-config').default;\n\nmodule.exports = flypeng();\n```\n\n#### `.stylelintrc`\n\n```json\n{\n  \"extends\": \"@flypeng/stylelint-config\"\n}\n```\n\n### Config `.prettierrc` and `.prettierignore`\n\n```json\n{\n  \"semi\": true,\n  \"singleQuote\": true,\n  \"bracketSpacing\": true,\n  \"printWidth\": 120,\n  \"vueIndentScriptAndStyle\": false\n}\n```\n\n```\n/dist/*\n.local\n.output.js\n/node_modules/**\n**/*.svg\n**/*.sh\n/public/*\n**/*.yaml\n```\n\n### Config Script\n\n```json\n{\n  \"scripts\": {\n    \"lint\": \"prettier . --write \u0026\u0026 eslint . \u0026\u0026 stylelint \\\"**/*.{css,scss,vue}\\\"\",\n    \"lint:fix\": \"prettier . --write \u0026\u0026 eslint . --fix \u0026\u0026 stylelint --fix \\\"**/*.{css,scss,sass,vue}\\\"\"\n  }\n}\n```\n\n### Config VSCode Settings\n\nInstall VSCode **ESLint**、**Stylelint**、**Prettier**、**Prettier ESLint** plugins and create `.vscode/settings.json`\n\n```json\n{\n  \"editor.formatOnSave\": true,\n  \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n  \"eslint.enable\": true,\n  \"eslint.useFlatConfig\": true, // 启用ESLint新的配置系统\n  \"eslint.format.enable\": true,\n  \"eslint.validate\": [\n    \"javascript\",\n    \"javascriptreact\",\n    \"typescript\",\n    \"typescriptreact\",\n    \"jsx\",\n    \"tsx\",\n    \"vue\",\n    \"html\",\n    \"markdown\",\n    \"json\",\n    \"jsonc\",\n    \"json5\",\n    \"yaml\"\n  ],\n  \"css.validate\": false,\n  \"less.validate\": false,\n  \"scss.validate\": false,\n  \"stylelint.enable\": true,\n  \"stylelint.validate\": [\"css\", \"less\", \"scss\", \"sass\", \"vue\", \"postcss\"]\n}\n```\n\n### Config `.editorconfig`\n\nThe configuration of.editorconfig is necessary for team development to ensure that the team editor behaves in a consistent style.\n\n```\n# EditorConfig helps developers define and maintain consistent\n# coding styles between different editors and IDEs\n# editorconfig.org\n\nroot = true\n\n[*]\n\n# We recommend you to keep these unchanged\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n# Change these settings to your own preference\nindent_style = space\nindent_size = 4\n\n[*.{ts,tsx,js,jsx,json,css,scss,yml,yaml,html,vue,md}]\nindent_size = 2\n\n[*.md]\ntrim_trailing_whitespace = false\n```\n\n### VSCode Extensions\n\n- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)\n- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)\n- [Stylelint](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)\n- [Prettier ESLint](https://marketplace.visualstudio.com/items?itemName=rvest.vs-code-prettier-eslint)\n- [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)\n\n## 🏍️ Overwrite rules\n\nIf you need to rewrite rules, you probably need to specify files scope, because the rules used by packages other than `@flypeng/eslint-config-javascript` are plugins for specific files. If you do not declare the file scope, unexpected errors will occur.\n\nExamples:\n\n```js\n// eslint.config.js\nimport flypeng from '@flypeng/eslint-config';\n\nexport default [\n  ...flypeng(),\n  {\n    /**\n     * If you do not declare the file Scope, other files will also refer to this rule.\n     * But the rules of other files do not use the @ typescript-eslint/eslint-plugin plugin, so an error will be reported during Lint.\n     * Reference detail: https://github.com/eslint/eslint/issues/17485\n     */\n    files: ['**/*.ts'],\n    rules: {\n      '@typescript-eslint/no-explicit-any': 'off',\n    },\n  },\n];\n```\n\n## ✍️ About using Prettier\n\nThere is a lot of discussion on the web about using Prettier for code formatting, and it is true that some aspects of Prettier's formatting are a bit mandatory, resulting in code that is less readable or not in your preferred style of code.\n\nOne of [Why I don't use Prettier](https://antfu.me/posts/why-not-prettier-zh) written by [Anthony Fu](https://github.com/antfu) accepts why Prettier is not applicable. See what he has to say.\n\nWhy did I enable Prettier for code formatting in `@flypeng/eslint-config`?\n\nThere are two main things I took into account:\n\nFirst, if you are an individual developer and you have a good grasp of the overall project code style, you can consider not using Prettier, but if you are a team developer, you can't guarantee that your code style will be accepted by the other team members and it will lead to a variety of code styles for the project as a whole. So this time you should consider using Prettier to force the unified code style.\n\nSecond: ESLint main responsibility is to verify the code rather than the code format , so for simple checksum automatic repair can be a certain degree of enlightenment to the role of formatting . But for the overall project code style ESLint does not guarantee that Prettier's main responsibility is to unify the overall style.\n\nBased on the above two points, I decided to open the use of Prettier.\n\n## ⚙️ About V1 to V2\n\nV2 is a refactoring of V1 in order to adapt ESLint's flat configuration and use Prettier as a code formatting tool.\n\nIf you need to adapt ESLint's flattened configuration, then all the packages you use internally need to use the new version of the flattened configuration. Fortunately, ESLint has provided an adaptation scheme, [eslintrc](https://github.com/eslint/eslintrc), to convert the old configuration to the new one.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflingyp%2Flint-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflingyp%2Flint-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflingyp%2Flint-config/lists"}