{"id":19325261,"url":"https://github.com/preco21/eslint-config","last_synced_at":"2025-07-16T08:13:47.229Z","repository":{"id":83178305,"uuid":"388845224","full_name":"preco21/eslint-config","owner":"preco21","description":"ESLint shareable config for @preco21","archived":false,"fork":false,"pushed_at":"2024-03-21T14:16:38.000Z","size":715,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-14T12:56:45.457Z","etag":null,"topics":["codestyle","config","eslint","preco21","styleguide"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/preco21.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-07-23T15:25:58.000Z","updated_at":"2024-03-21T14:16:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"590fd312-0a23-4586-b28f-da3b5832bedd","html_url":"https://github.com/preco21/eslint-config","commit_stats":{"total_commits":44,"total_committers":1,"mean_commits":44.0,"dds":0.0,"last_synced_commit":"f43a9c184b988d252f423349f69880cbf1b6622a"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/preco21/eslint-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Feslint-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Feslint-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Feslint-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Feslint-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/preco21","download_url":"https://codeload.github.com/preco21/eslint-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Feslint-config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265495766,"owners_count":23776679,"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":["codestyle","config","eslint","preco21","styleguide"],"created_at":"2024-11-10T02:09:23.097Z","updated_at":"2025-07-16T08:13:47.200Z","avatar_url":"https://github.com/preco21.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [\u003cimg src=\"https://github.com/preco21/eslint-config/blob/main/media/logo.svg?raw=true\" align=\"center\" /\u003e](https://github.com/preco21/eslint-config) eslint-config\n\n\u003e ESLint shareable config for `@preco21`\n\nThis package provides @preco21's ESLint rules as an extensible shared config.\n\n## Install\n\n```shell\nnpm install --save-dev @preco21/eslint-config\n```\n\n### Peer dependencies\n\nIf you are only interested in the core rules (e.g. `rules/base`), you are good to go and you don’t need to follow installation instructions below.\n\nThere are configs that work with various plugins like `typescript`, `import`, `react`, and so on. (`import`, `react` rules are not yet supported)\n\nTo use those, you will need to install all its peer dependencies.\n\nBy default, to prevent installing unnecessary peer dependencies, all listed peer dependencies (except the `eslint` itself) are marked as optional via [`peerDependenciesMeta` field](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#peerdependenciesmeta) in the `package.json`. And it's recommended to install only peer dependencies that you are going to use.\n\nInstall the correct versions of each package, which are listed by the command:\n\n```shell\nnpm info \"@preco21/eslint-config@latest\" peerDependencies\n```\n\nIf using npm 5+, use this shortcut:\n\n```shell\nnpx install-peerdeps --dev @preco21/eslint-config\n```\n\nOr manually:\n\n```shell\nnpm install --dev eslint @preco21/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react\n```\n\nFor more details about the installation, please refer to [Airbnb's ESLint config documentation](https://github.com/airbnb/javascript/blob/f5c14cae2ff58000cead98290b8ec4b54dda2f14/packages/eslint-config-airbnb-base/README.md#usage).\n\n## Usage\n\nAdd some ESLint config to your `package.json`:\n\n```json\n{\n  \"eslintConfig\": {\n    \"root\": true,\n    \"extends\": \"@preco21/eslint-config\"\n  }\n}\n```\n\nOr with `.eslintrc`:\n\n```json\n{\n  \"root\": true,\n  \"extends\": \"@preco21/eslint-config\"\n}\n```\n\nYou can find more details about ESLint configuration [here](http://eslint.org/docs/user-guide/configuring).\n\n## Available configs\n\nThe package exposes two types of the config: `top-level` and `individual`.\n\n### Top-level configs\n\nTop-level configs work in a zero-configuration manner, which you don't need extra configuration to use the config:\n\n```json\n{\n  \"extends\": \"@preco21/eslint-config\"\n}\n```\n\nEvery top-level config has [ECMAScript modules](http://2ality.com/2014/09/es6-modules-final.html) support and latest ECMAScript features enabled by default.\n\n### Individual configs\n\nIf the top-level configs don't fit in your use-cases, you may assemble your own config by mixing individual configs exposed from the `rules` folder:\n\n```json\n{\n  \"extends\": [\n    \"@preco21/eslint-config/rules/base\",\n    \"@preco21/eslint-config/rules/typescript\",\n    ...\n  ]\n}\n```\n\nIt's recommended to use other configs upon the `base` config, since it contains sensible default rules to work with.\n\nHowever, you can make changes to configuration for extra options like `env` or `parserOptions` if it's necessary.\n\nFor example:\n\n```json\n{\n  \"env\": {\n    \"es6\": true,\n    \"node\": true\n  },\n  \"parserOptions\": {\n    \"ecmaVersion\": \"latest\",\n    \"sourceType\": \"module\"\n  },\n  \"extends\": [\n    \"@preco21/eslint-config/rules/base\",\n    \"@preco21/eslint-config/rules/typescript\"\n  ]\n}\n```\n\nAlso, you may need to install optional plugins to use some config. (see [install](#install) section)\n\n## Tips\n\n### Browser\n\nIf you are in _browser_ environment, you can add `browser` option to `env` field:\n\n```json\n{\n  \"env\": {\n    \"browser\": true\n  }\n}\n```\n\n- [Why there's no such thing like `@preco21/eslint-config/browser`?](https://github.com/airbnb/javascript/issues/1002)\n\n### Using globals\n\nAs ESLint makes no assumptions about what global variables exist in your execution environment, you will need to provide knowledge of what global variables are available. (e.g. referring external library at runtime)\n\nYou can define global variables in your configuration as follows:\n\n```json\n{\n  \"globals\": {\n    \"$\": \"readonly\"\n  }\n}\n```\n\nFor each global variable key, set the corresponding value equal to `writable` to allow the variable to be overwritten or `readonly` to disallow overwriting.\n\nSee [here](https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals) for more details.\n\n### Using `script` source type\n\nEvery top-level config treats your code are in ECMAScript modules enabled environment by default. Add this to your configuration if you want to disable it:\n\n```json\n{\n  \"parserOptions\": {\n    \"sourceType\": \"script\"\n  }\n}\n```\n\n### Using ECMAScript 5\n\nAlthough this is not generally recommended, you can fallback to ECMAScript 5 by adding this to your configuration:\n\n```json\n{\n  \"extends\": [\n    \"@preco21/eslint-config/rules/base\",\n    \"@preco21/eslint-config/rules/with-es5\"\n  ]\n}\n```\n\nPlease note that the `with-es5` config automatically enables `strict` rule.\n\n**Note:** However, ESLint might still show unexpected errors or warnings because the rules in this config were defined under the assumption that users will be writing ES2015+ code. In this case, you can safely disable the problematic rules manually.\n\n### Enforcing strict mode\n\nThe config doesn't enable the [`strict` rule](https://eslint.org/docs/rules/strict) by default for a good reason as: Today, we all use tooling like `webpack`, `Babel`, and languages like `TypeScript`. And these tools automatically insert a `'use strict'` directive for each source to ensure your code is in `strict mode`.\n\nAlso, ECMAScript modules enabled environments are `strict mode` by default.\n\nSo, enabling `strict` rule to ensure if the `'use strict'` directive is properly placed in your source doesn't really help but redundant.\n\nBut, often you do need the rule for writing non-compiled code like CLI scripts.\n\nThen, you can optionally enable the rule for the specific case:\n\n```json\n{\n  \"overrides\": [\n    {\n      \"files\": [\"bin/**/*.js\"],\n      \"parserOptions\": {\n        \"sourceType\": \"script\",\n        \"ecmaFeatures\": {\n          \"jsx\": false\n        }\n      },\n      \"rules\": {\n        \"strict\": \"error\"\n      }\n    }\n  ]\n}\n```\n\n### Electron\n\nIf you are in [Electron](https://electronjs.org/) environment, you may need to add `electron` to `import/core-modules` setting. So that [`eslint-import-plugin`](https://github.com/benmosher/eslint-plugin-import) can consider the `electron` module as a `core` module like `path`:\n\n```json\n{\n  \"settings\": {\n    \"import/core-modules\": [\"electron\"]\n  }\n}\n```\n\nFor more details, see [here](https://github.com/benmosher/eslint-plugin-import#importcore-modules).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreco21%2Feslint-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpreco21%2Feslint-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreco21%2Feslint-config/lists"}