{"id":24532934,"url":"https://github.com/mcecode/eslint-config-mcecode","last_synced_at":"2025-06-12T19:06:44.068Z","repository":{"id":57228648,"uuid":"391184228","full_name":"mcecode/eslint-config-mcecode","owner":"mcecode","description":"An opinionated set of ESLint rules that work with Prettier out of the box.","archived":false,"fork":false,"pushed_at":"2023-01-19T09:02:31.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-23T01:24:37.705Z","etag":null,"topics":["eslint","eslintconfig","prettier"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eslint-config-mcecode","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcecode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-30T20:44:57.000Z","updated_at":"2023-01-26T07:59:37.000Z","dependencies_parsed_at":"2023-02-10T21:45:31.726Z","dependency_job_id":null,"html_url":"https://github.com/mcecode/eslint-config-mcecode","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/mcecode/eslint-config-mcecode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcecode%2Feslint-config-mcecode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcecode%2Feslint-config-mcecode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcecode%2Feslint-config-mcecode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcecode%2Feslint-config-mcecode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcecode","download_url":"https://codeload.github.com/mcecode/eslint-config-mcecode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcecode%2Feslint-config-mcecode/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259519812,"owners_count":22870368,"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":["eslint","eslintconfig","prettier"],"created_at":"2025-01-22T10:18:59.500Z","updated_at":"2025-06-12T19:06:44.035Z","avatar_url":"https://github.com/mcecode.png","language":"JavaScript","readme":"# eslint-config-mcecode\n\nAn opinionated set of [ESLint](https://eslint.org) rules that work with [Prettier](https://prettier.io) out of the box.\n\n**Note:** This package only ships rules, you would still need to set [`env` and other configs](https://eslint.org/docs/latest/use/configure) to properly tell ESLint how you want it to analyze your code, so that it knows what to expect, such as what global variables you will be using.\n\n## Requirements\n\nThis package requires ESLint version 8.27.0 or later. It also assumes that you are working in an ECMAScript 2018 or later environment.\n\n## Installation\n\n```console\nnpm install --save-dev eslint-config-mcecode\n```\n\n**Note:** This package lists ESLint as a peer dependency as [they instructed when creating shareable configs](https://eslint.org/docs/latest/extend/shareable-configs#publishing-a-shareable-config). When installing packages, [npm versions before version 7 do not install peer dependencies by default](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependencies), so you would still need to install ESLint as a separate dependency when using npm version 6 or lower.\n\n## Usage\n\n[Extend](https://eslint.org/docs/latest/use/configure/configuration-files#extending-configuration-files) this package by adding it to your `.eslintrc.*` file or in the `eslintConfig` property of your `package.json`.\n\nIn your `.eslintrc.js` or `.eslintrc.cjs`,\n\n```js\nmodule.exports = {\n  extends: \"mcecode\"\n};\n```\n\nIn your `.eslintrc.yaml` or `.eslintrc.yml`,\n\n```yaml\nextends: mcecode\n```\n\nIn your `.eslintrc.json`,\n\n```json\n{\n  \"extends\": \"mcecode\"\n}\n```\n\nIn your `package.json`,\n\n```json\n{\n  \"eslintConfig\": {\n    \"extends\": \"mcecode\"\n  }\n}\n```\n\n## Caveats\n\n### When using with other ESLint configs\n\nTo work with Prettier, this package does not turn on any rules that may conflict with Prettier. It does not turn off rules. This means that if you plan to use it with other configs, you may still need to use [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) to turn off any rules that those packages turn on that may conflict with Prettier. However, [as will be discussed next](#when-using-with-prettier), this package enables special rules. These rules may be turned off if used with eslint-config-prettier. To prevent this, put this config at the end of your `extends` array.\n\nIn your `.eslintrc.json`,\n\n```jsonc\n{\n  \"extends\": [\n    // ...other configs\n    \"prettier\",\n    \"mcecode\"\n  ]\n}\n```\n\n### When using with Prettier\n\nMost of the [special rules](https://github.com/prettier/eslint-config-prettier#special-rules) that this package enables work well with Prettier out of the box. However, there are some which may conflict with prettier if not addressed. Below are some gotchas about them.\n\n#### `max-len`\n\n[ESLint docs](https://eslint.org/docs/latest/rules/max-len) | [Prettier docs](https://github.com/prettier/eslint-config-prettier#max-len)\n\n**Note:** There is no need to worry about this rule if you will not change [Prettier's default `printWidth` option](https://prettier.io/docs/en/options.html#print-width).\n\nPrettier sets a soft line limit for code and cannot format long strings, regular expressions, comments, and other things that need to be broken up by a human. This package enables the `max-len` rule to enforce a hard limit. It sets a maximum line length of 100 for code and 80 for comments while ignoring URLs.\n\nThis means that when using this package, you should set Prettier's `printWidth` option to a value less than 100.\n\nIn your `.prettierrc.json`,\n\n```json\n{\n  \"printWidth\": 90\n}\n```\n\nAdditionally, you may turn this rule off if you do not wish to set hard limits on line length.\n\nIn your `.eslintrc.json`,\n\n```json\n{\n  \"rules\": {\n    \"max-len\": \"off\"\n  }\n}\n```\n\n#### `no-unexpected-multiline`\n\n[ESLint docs](https://eslint.org/docs/latest/rules/no-unexpected-multiline) | [Prettier docs](https://github.com/prettier/eslint-config-prettier#no-unexpected-multiline)\n\nThere are some edge cases that you may run into where Prettier's formatting may conflict with this rule. Please refer to Prettier's documentation linked above which explains those edge cases and how to mitigate them.\n\nIf you do not want to deal with or risk running into those edge cases, you can turn this rule off.\n\nIn your `.eslintrc.json`,\n\n```json\n{\n  \"rules\": {\n    \"no-unexpected-multiline\": \"off\"\n  }\n}\n```\n\n#### `quotes`\n\n[ESLint docs](https://eslint.org/docs/latest/rules/quotes) | [Prettier docs](https://github.com/prettier/eslint-config-prettier#quotes)\n\n**Note:** There is no need to worry about this rule if you will not change [Prettier's default `singleQuote` option](https://prettier.io/docs/en/options.html#quotes).\n\nThis package enables this rule to enforce double (\") quotes and to forbid backticks (`) where regular strings could have been used.\n\nIf you wish to use single (') quotes or backticks for strings, you can set your config to support that based on the ESLint documentation linked above. You may also choose to turn this rule off.\n\nIn your `.eslintrc.json`,\n\n```json\n{\n  \"rules\": {\n    \"quotes\": \"off\"\n  }\n}\n```\n\n### Special comments\n\nESLint allows disabling rule warnings using [configuration comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) such as `/* eslint-disable no-empty */`. This package enables rules whose warnings can be suppressed using regular comments that can help provide more context than just turning off the rule.\n\nThe following are the said rules:\n\n- [`no-empty`](https://eslint.org/docs/latest/rules/no-empty)\n- [`no-empty-function`](https://eslint.org/docs/latest/rules/no-empty-function)\n- [`default-case`](https://eslint.org/docs/latest/rules/default-case)\n- [`no-fallthrough`](https://eslint.org/docs/latest/rules/no-fallthrough)\n\nBelow are examples of how to suppress their warnings using meaningful comments.\n\nInstead of disabling `no-empty` or `no-empty-function`, you can explain why they are empty:\n\n```js\ntry {\n  throw new Error();\n} catch {\n  // This does not need to be handled because...\n}\n\nfunction doSomething() {\n  // TODO: Do something with...\n}\n```\n\nInstead of disabling `default-case` or `no-fallthrough`, you can state why fall through behavior or not putting a default case is intended:\n\n```js\nswitch (key) {\n  case 1: {\n    // Some code\n    // This needs to fall through because...\n  }\n\n  case 2: {\n    // Some code that can run on its own but should run after the previous case\n    break;\n  }\n\n  // There is no default case because...\n}\n```\n\n## Contributing\n\nIf you find anything wrong or would like to suggest changes, issues and pull requests are welcome.\n\nThe [`src`](src) directory contains the files that would most likely be of interest to you. The following are the files:\n\n- [`base-rules.js`](src/base-rules.js) contains rules that should not conflict with Prettier.\n- [`prettier-special-rules.js`](src/prettier-special-rules.js) contains rules that may conflict with Prettier, [as discussed earlier](#when-using-with-prettier).\n\nBe sure to find and fix any errors before you submit a pull request by running the following commands.\n\nInstall dev dependencies:\n\n```console\nnpm install\n```\n\nTest if the rules you added or changed are valid:\n\n```console\nnpm test\n```\n\nLint the code for possible errors:\n\n```console\nnpm run lint\n```\n\nFormat the code:\n\n```console\nnpm run format\n```\n\n## Versioning\n\nThis project adheres to the [Semantic Versioning 2.0 Specification](https://semver.org). However, given the nature of the project, it may be hard to determine what constitutes a major, minor, or patch release. This section aims to clarify that.\n\n### Major\n\nMajor releases introduce changes that alter how ESLint lints your code which would most likely break tests or builds. These include:\n\n- Adding rules and/or options that enable new behavior\n- Removing options that disabled linting behavior (e.g., removing the [`ignoreUrls: true`](https://eslint.org/docs/latest/rules/max-len#ignoreurls) option for the [`max-len`](https://eslint.org/docs/latest/rules/max-len) rule would make ESLint start flagging lines that have long URLs, which may break tests and builds that currently pass)\n- Increasing the error level of a rule (i.e., setting a rule's ID from `\"warn\"` to `\"error\"`)\n- Changing the package's required ESLint version\n\n### Minor\n\nMinor releases introduce changes that alter how ESLint lints your code which would most likely not break tests or builds. These include:\n\n- Removing rules\n- Removing options that enabled linting behavior (e.g., removing the [`skipStrings: false`](https://eslint.org/docs/latest/rules/no-irregular-whitespace#skipstrings) option for the [`no-irregular-whitespace`](https://eslint.org/docs/latest/rules/no-irregular-whitespace) rule would stop ESLint from checking strings with irregular whitespace characters, which may pass tests and builds that currently fail)\n- Decreasing the error level of a rule (i.e., setting a rule's ID from `\"error\"` to `\"warn\"`)\n\n### Patch\n\nPatch releases introduce changes that do not alter how ESLint lints your code. These include:\n\n- Removing redundant rules and/or options (e.g., setting the [`defaultAssignment`](https://eslint.org/docs/latest/rules/no-unneeded-ternary#defaultassignment) option to `true` for the [`no-unneeded-ternary`](https://eslint.org/docs/latest/rules/no-unneeded-ternary) rule is unnecessary and does not do anything because it is the default option, therefore, it can be removed without changing ESLint's behavior)\n\n## License\n\nCopyright 2021-present Matthew Espino\n\nThis project is licensed under the [Apache 2.0 license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcecode%2Feslint-config-mcecode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcecode%2Feslint-config-mcecode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcecode%2Feslint-config-mcecode/lists"}