{"id":15198520,"url":"https://github.com/upstatement/eslint-config","last_synced_at":"2025-10-06T08:07:53.538Z","repository":{"id":51335125,"uuid":"138649305","full_name":"Upstatement/eslint-config","owner":"Upstatement","description":"Upstatement's ESLint Config","archived":false,"fork":false,"pushed_at":"2024-01-05T15:49:02.000Z","size":94,"stargazers_count":11,"open_issues_count":1,"forks_count":2,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-09-13T23:28:48.819Z","etag":null,"topics":["eslint","eslint-config"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@upstatement/eslint-config","language":"JavaScript","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/Upstatement.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,"publiccode":null,"codemeta":null}},"created_at":"2018-06-25T20:57:03.000Z","updated_at":"2024-09-29T11:15:40.000Z","dependencies_parsed_at":"2024-06-18T18:35:45.710Z","dependency_job_id":"5b03db7d-9dec-48a1-ad25-de9e18376512","html_url":"https://github.com/Upstatement/eslint-config","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Upstatement/eslint-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstatement%2Feslint-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstatement%2Feslint-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstatement%2Feslint-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstatement%2Feslint-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Upstatement","download_url":"https://codeload.github.com/Upstatement/eslint-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstatement%2Feslint-config/sbom","scorecard":{"id":146314,"data":{"date":"2025-08-11","repo":{"name":"github.com/Upstatement/eslint-config","commit":"733fbeddb201c1df69d659a492d8a0fc88533c97"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":2,"reason":"Found 3/12 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T09:28:19.862Z","repository_id":51335125,"created_at":"2025-08-16T09:28:19.863Z","updated_at":"2025-08-16T09:28:19.863Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278577929,"owners_count":26009703,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","eslint-config"],"created_at":"2024-09-28T01:20:48.121Z","updated_at":"2025-10-06T08:07:53.513Z","avatar_url":"https://github.com/Upstatement.png","language":"JavaScript","readme":"# Upstatement ESLint Config\n\n[![npm version](https://badge.fury.io/js/%40upstatement%2Feslint-config.svg)](https://badge.fury.io/js/%40upstatement%2Feslint-config)\n\nPairs well with our [Prettier config](https://www.npmjs.com/package/@upstatement/prettier-config).\n\n## Table of Contents\n\n- [Upstatement ESLint Config](#upstatement-eslint-config)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n  - [Configurations](#configurations)\n    - [Default Config](#default-config)\n    - [Four Spaces Config](#four-spaces-config)\n    - [React Config](#react-config)\n      - [Using Create React App?](#using-create-react-app)\n    - [Vue Config](#vue-config)\n  - [Specifying Environments](#specifying-environments)\n  - [Editor Integration \\\u0026 Autoformatting](#editor-integration--autoformatting)\n    - [VS Code](#vs-code)\n    - [Sublime Text](#sublime-text)\n    - [Atom](#atom)\n  - [Pre-commit Hooks](#pre-commit-hooks)\n  - [Publishing to npm](#publishing-to-npm)\n  - [Enforced Rules](#enforced-rules)\n  - [Overriding Rules](#overriding-rules)\n\n## Installation\n\nThis package has several [peer dependencies](https://docs.npmjs.com/files/package.json#peerdependencies).\n\nRun `npm info \"@upstatement/eslint-config@latest\" peerDependencies` to list the peer dependencies and versions.\n\n1. Make sure your project is using a Node version \u003e= `10.12.0`\n\n2. Install dependencies\n\n   - **Option 1:** With `npx`\n\n     ```sh\n     npx install-peerdeps --dev @upstatement/eslint-config\n     ```\n\n     **Note:** `npx` is a package runner that comes with npm 5.2 and higher that makes installing peer dependencies easier\n\n   - **Option 2:** Without `npx`\n\n     ```sh\n     npm install --save-dev @upstatement/eslint-config @babel/core@7.x.x @babel/eslint-parser@7.x.x eslint@8.x.x eslint-config-prettier@9.x.x prettier@3.x.x\n\n     # or\n\n     yarn add --dev @upstatement/eslint-config @babel/core@7.x.x @babel/eslint-parser@7.x.x eslint@8.x.x eslint-config-prettier@9.x.x prettier@3.x.x\n     ```\n\n3. Create an `.eslintrc` file at the root of your project with the following:\n\n   ```json\n   {\n     \"root\": true,\n     \"extends\": \"@upstatement\"\n   }\n   ```\n\n   Then make sure to [specify your environment](#specifying-environments) based on your project.\n\n## Configurations\n\nWe export four ESLint configurations for your usage:\n\n1. [Default (2 space)](#default-config)\n2. [Four Spaces](#four-spaces-config)\n3. [React](#react-config)\n4. [Vue](#vue-config)\n\n### Default Config\n\nIn your `.eslintrc`:\n\n```json\n{\n  \"root\": true,\n  \"extends\": \"@upstatement\"\n}\n```\n\n\u003e **NOTE:** Make sure to [specify your environment](#specifying-environments) based on your project\n\n### Four Spaces Config\n\nIncludes everything in the default config, but replaces the indent rule with 4 spaces instead of 2 spaces.\n\nIn your `.eslintrc`:\n\n```json\n{\n  \"root\": true,\n  \"extends\": \"@upstatement/eslint-config/four-spaces\"\n}\n```\n\n\u003e **NOTE:** Make sure to [specify your environment](#specifying-environments) based on your project\n\n### React Config\n\nIncludes everything in the default config, plus environment specification and react-specific rules with\n\n- [`eslint-plugin-react`](https://github.com/yannickcr/eslint-plugin-react)\n- [`eslint-plugin-jsx-a11y`](https://github.com/evcohen/eslint-plugin-jsx-a11y)\n- [`@babel/preset-react`](https://github.com/babel/babel/tree/master/packages/babel-preset-react)\n\n```sh\nnpx install-peerdeps --dev @upstatement/eslint-config \\\n  \u0026\u0026 npm install --save-dev eslint-plugin-react eslint-plugin-jsx-a11y @babel/preset-react\n```\n\n**In your `.eslintrc`:**\n\n```json\n{\n  \"root\": true,\n  \"extends\": \"@upstatement/eslint-config/react\"\n}\n```\n\n**In your `.babelrc`:**\n\n```json\n{\n  \"presets\": [\"@babel/preset-react\"]\n}\n```\n\n#### Using Create React App?\n\nUntil recently Create React App didn't give you an easy way to extend the default ESLint configuration short of ejecting. This was particularly problematic as ESLint is run during production builds (with `react-scripts build`), and lint errors would actually result in build failures.\n\nIt now supports an [experimental method to extend ESLint](https://create-react-app.dev/docs/setting-up-your-editor/#experimental-extending-the-eslint-config). Here's how it works with this configuration:\n\n1. Extend the base config (`react-app`) in your ESLint configuration:\n\n   ```json\n   {\n     \"root\": true,\n     \"extends\": [\"react-app\", \"@upstatement/eslint-config/react\"]\n   }\n   ```\n\n2. Add the babel config\n\n   ```json\n   {\n     \"presets\": [\"@babel/preset-react\"]\n   }\n   ```\n\n3. Set the `EXTEND_ESLINT` environment variable in your `.env` file (for local development) and in your hosting providers environment variables configuration (for remote builds):\n\n   ```json\n   EXTEND_ESLINT=true\n   ```\n\nThis will ensure that the same ruleset is enforced for local development and production builds.\n\n### Vue Config\n\nIncludes everything in the default config, plus environment specification and vue-specific rules with\n\n- [`eslint-plugin-vue`](https://github.com/vuejs/eslint-plugin-vue)\n- [`vue-eslint-parser`](https://github.com/mysticatea/vue-eslint-parser)\n\n```sh\nnpx install-peerdeps --dev @upstatement/eslint-config \\\n  \u0026\u0026 eslint-plugin-vue vue-eslint-parser\n```\n\nIn your `.eslintrc`\n\n```json\n{\n  \"root\": true,\n  \"extends\": \"@upstatement/eslint-config/vue\"\n}\n```\n\n## Specifying Environments\n\nOur default \u0026 four spaces configs purposefully do not specify a certain environment as to not make any assumptions about your project. The only environment we do specify by default is `es6`. [View all available environments](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments)\n\nTherefore, you should specify your project's environment yourself in your ESLint config. For example:\n\n```json\n{\n  \"root\": true,\n  \"extends\": \"@upstatement\",\n  \"env\": {\n    \"browser\": true,\n    \"node\": true\n  }\n}\n```\n\n## [Editor Integration](https://eslint.org/docs/user-guide/integrations) \u0026 Autoformatting\n\nOnce you've installed the config, you probably want your editor to lint and fix your code for you.\n\n### VS Code\n\n1. Install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint): `View → Extensions` then find and install ESLint\n2. Reload the editor\n3. Open your [settings JSON file](https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations) and add the following\n\n   ```json\n   // Format on save with Prettier rules\n   \"editor.formatOnSave\": true,\n   // Tell the ESLint plugin to run on save\n   \"editor.codeActionsOnSave\": {\n     \"source.fixAll.eslint\": true\n   },\n   // Turn off Prettier format on save, use ESLint to format instead\n   \"[javascript]\": {\n     \"editor.formatOnSave\": false\n   },\n   \"[vue]\": {\n     \"editor.formatOnSave\": false\n   },\n   \"eslint.alwaysShowStatus\": true,\n   // An array of language identifiers specify the files to be validated\n   \"eslint.options\": {\n     \"extensions\": [\".html\", \".js\", \".vue\", \".jsx\"]\n   },\n   ```\n\n### Sublime Text\n\n1. Install [Package Control](https://packagecontrol.io/installation)\n2. Install [ESLint-Formatter](https://github.com/TheSavior/ESLint-Formatter)\n3. And then allow auto fix on save: `Preferences → Package Settings → ESLint Formatter → Settings` then add `\"format_on_save\": true` to the settings file\n\n### Atom\n\n1. Install [linter-eslint](https://github.com/AtomLinter/linter-eslint) plugin: `Preferences → Install` then type and install `linter-eslint`\n2. Install all dependencies (and restart the editor couple of times during installation)\n3. Enable auto fix on save: `Preferences → Packages → linter-eslint` then check `Fix errors on save checkbox`\n\n## Pre-commit Hooks\n\nAs another line of defense, if you want ESLint \u0026 Prettier to automatically fix your errors on commit, you can use [lint-staged](https://github.com/okonet/lint-staged) with [husky](https://github.com/typicode/husky).\n\n1. Make sure [eslint](#eslint) \u0026 [prettier](#prettier) configs are installed and set up\n\n2. Make sure your `npm` version is \u003e= 7.0.0\n\n   ```shell\n   npm install -g npm@latest\n   ```\n\n3. Make sure your repo has been initialized with git\n\n   ```shell\n   git init --initial-branch=main\n   ```\n\n4. Install the npm packages\n\n   ```shell\n   npm install --save-dev lint-staged husky\n   ```\n\n5. Set up the `package.json` stuff\n\n   ```shell\n   npm set-script prepare \"husky install\" \u0026\u0026 npm run prepare \\\n     \u0026\u0026 npm set-script lint-staged \"lint-staged\" \\\n     \u0026\u0026 npx husky add .husky/pre-commit \"npm run lint-staged\"\n   ```\n\n6. Then in your `package.json` add\n\n   ```json\n    \"lint-staged\": {\n      \"*.{js,css,json,md}\": [\n        \"prettier --write\",\n        \"git add\"\n      ],\n      \"*.js\": [\n        \"eslint --fix\",\n        \"git add\"\n      ]\n    }\n   ```\n\n## Publishing to npm\n\nRead npm's docs on [How to Update a Package](https://docs.npmjs.com/getting-started/publishing-npm-packages#how-to-update-a-package).\n\n1. Checkout and pull the `main` branch\n\n2. Run the release script to bump the version numbers (the script will create a commit and push up the release branch to GitHub for you)\n\n   ```shell\n   ./scripts/release\n   ```\n\n   Use [semantic versioning](https://docs.npmjs.com/about-semantic-versioning/) to choose the appropriate version number.\n\n3. Submit and merge a PR from the release branch into `main`\n\n4. Make sure you're logged into npm from the command line using `npm whoami`. If you're not logged in, `npm login` with the credentials in 1pass\n\n5. `npm publish`\n\n## Enforced Rules\n\nUpstatement's ESLint config extends `eslint:recommended` which enables rules that report common problems, which are marked with check marks in the large [list of ESLint rules](https://eslint.org/docs/rules/).\n\nThe rules listed below are rules we have enabled on top of those enabled by `eslint:recommended`.\n\n\u003cdetails\u003e\n  \u003csummary\u003eno-console\u003c/summary\u003e\n\nIt's perfectly fine to use `console.log` during development, but you shouldn't use `console.log` in production code. If you _really_ need to print something to the console, use `console.warn` or `console.error`.\n\n\u003e Why? In JavaScript that's designed to be executed in the browser, it’s considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.\n\n```js\n// bad\nconsole.log(\"bad\");\n\n// good\nconsole.warn(\"Log a warn level message.\");\nconsole.error(\"Log an error level message.\");\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ecurly\u003c/summary\u003e\n\nAlways use curly braces.\n\n\u003e Why? Omitting curly braces can cause bugs and decrease code clarity.\n\n```js\n// bad\nif (foo) foo++;\n\nif (foo) {\n  baz();\n} else qux();\n\n// good\nif (foo) {\n  foo++;\n}\n\nif (foo) {\n  baz();\n} else {\n  qux();\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eeqeqeq\u003c/summary\u003e\n\nUse `===` and `!==` over `==` and `!=`.\n\n\u003e Why? It's considered good practice to use the type-safe equality operators `===` and `!==` instead of their regular counterparts `==` and `!=`. The reason for this is that `==` and `!=` do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:\n\u003e\n\u003e - [] == false\n\u003e - [] == ![]\n\u003e - 3 == 03\n\nTL;DR JavaScript is _**WILD**_\n\n```js\n// bad\na == b;\nfoo == true;\nbananas != 1;\nvalue == undefined;\ntypeof foo == \"undefined\";\n\n// good\na === b;\nfoo === true;\nbananas !== 1;\nvalue === undefined;\ntypeof foo === \"undefined\";\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eno-eq-null\u003c/summary\u003e\n\nDon't write `null` comparisons without type-checking operators.\n\n\u003e Why? Comparing to `null` without a type-checking operator (`==` or `!=`), can have unintended results as the comparison will evaluate to true when comparing to not just a `null`, but also an `undefined` value.\n\n```js\n// bad\nif (foo == null) {\n  bar();\n}\n\nwhile (qux != null) {\n  baz();\n}\n\n// good\nif (foo === null) {\n  bar();\n}\n\nwhile (qux !== null) {\n  baz();\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eno-use-before-define\u003c/summary\u003e\n\nDon't use constiables before they are defined.\n\n\u003e Why? In JavaScript, prior to ES6, constiable and function declarations are hoisted to the top of a scope, so it’s possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare constiables and functions before using them.\n\u003e In ES6, block-level bindings (`let` and `const`) introduce a “temporal dead zone” where a `ReferenceError` will be thrown with any attempt to access the constiable before its declaration.\n\n```js\n// bad\nalert(a);\nconst a = 10;\n\nf();\nfunction f() {}\n\n// good\nlet a;\na = 10;\nalert(a);\n\nfunction f() {}\nf(1);\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ebrace-style\u003c/summary\u003e\n\nBe consistent with brace style for blocks. Keep `else` on the same line as the preceding curly brace.\n\n```js\n// bad\nif (foo) {\n  bar();\n} else {\n  baz();\n}\n\n// good\nif (foo) {\n  bar();\n} else {\n  baz();\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ecomma-dangle\u003c/summary\u003e\n\nUse trailing commas when possible.\n\n\u003e Why? Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. They improve the clarity of diffs when an item is added or removed from an object or array.\n\n```js\n// bad\nconst foo = {\n  bar: baz,\n  qux: quux,\n};\n\nconst arr = [1, 2];\n\n// good\nconst foo = {\n  bar: baz,\n  qux: quux,\n};\n\nconst arr = [1, 2];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ecomma-spacing\u003c/summary\u003e\n\nPut spaces after commas. Don't put spaces before commas.\n\n```js\n// bad\nconst foo = 1,\n  bar = 2;\nconst arr = [1, 2];\nconst obj = { foo: bar, baz: qur };\nfoo(a, b);\n\n// good\nconst foo = 1,\n  bar = 2;\nconst arr = [1, 2];\nconst obj = { foo: bar, baz: qur };\nfoo(a, b);\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ecomma-style\u003c/summary\u003e\n\nCommas should come after and on the same line as an array element, object property, or constiable declaration.\n\n```js\n// bad\nconst foo = 1,\n  bar = 2;\n\nconst foo = 1,\n  bar = 2;\n\nconst foo = [\"apples\", \"oranges\"];\n\nfunction bar() {\n  return {\n    a: 1,\n    b: 2,\n  };\n}\n\n// good\nconst foo = 1,\n  bar = 2;\n\nconst foo = [\"apples\", \"oranges\"];\n\nfunction bar() {\n  return {\n    a: 1,\n    b: 2,\n  };\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003efunc-call-spacing\u003c/summary\u003e\n\nDon't add a space between a function name and the opening parenthesis.\n\n```js\n// bad\nfn();\n\n// good\nfn();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eindent\u003c/summary\u003e\n\nThis ESLint config defaults to 2 space indentation.\n\n\u003e Why? The general convention within the JavaScript community is 2 spaces, and ESLint is a \"pluggable linting utility for JavaScript and JSX\". We could debate 2 spaces vs 4 spaces all day long, so that's why we've provided another configuration for 4 spaces.\n\n```js\n// bad\nif (a) {\n  b = c;\n  function foo(d) {\n    e = f;\n  }\n}\n\n// good\nif (a) {\n  b = c;\n  function foo(d) {\n    e = f;\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ekey-spacing\u003c/summary\u003e\n\nUse consistent spacing between keys and values in object literals. Use a space after the colon and disallows a space before the colon.\n\n```js\n// bad\nconst obj = { foo: 42 };\nconst obj = { foo: 42 };\n\n// good\nconst obj = { foo: 42 };\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ekeyword-spacing\u003c/summary\u003e\n\nUse consistent spacing before and after keywords. Use at least one space before and after keywords.\n\n```js\n// bad\nif (foo) {\n  //...\n} else if (bar) {\n  //...\n} else {\n  //...\n}\n\n// good\nif (foo) {\n  //...\n} else if (bar) {\n  //...\n} else {\n  //...\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eobject-curly-spacing\u003c/summary\u003e\n\nUse a space inside of braces (except `{}`)\n\n```js\n// bad\nconst obj = { foo: \"bar\" };\nconst obj = { foo: \"bar\" };\nconst obj = { foo: \"bar\" };\nconst { x } = y;\nimport { foo } from \"bar\";\n\n// good\nconst obj = {};\nconst obj = { foo: \"bar\" };\nconst obj = {\n  foo: \"bar\",\n};\nconst { x } = y;\nimport { foo } from \"bar\";\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eone-const\u003c/summary\u003e\n\nUse multiple constiable declarations per scope.\n\n\u003e Why? It simplifies adding and removing constiables, since only the lines you are modifying must be touched. It improves the clarity of diffs when a constiable is added to a scope.\n\n```js\n// bad\nfunction foo() {\n  let bar, baz;\n  const bar = true,\n    baz = false;\n}\n\n// good\nfunction foo() {\n  let bar;\n  let baz;\n  const bar = true;\n  const baz = false;\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003equotes\u003c/summary\u003e\n\nUse single quotes wherever possible. Use backticks with template literals.\n\n```js\n// bad\nconst double = double;\nconst unescaped = 'a string containing \"double\" quotes';\n\n// good\nconst single = \"single\";\nconst backtick = `back${x}tick`;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003esemi\u003c/summary\u003e\n\nUse semicolons at the end of statements.\n\n\u003e Why? When JavaScript encounters a line break without a semicolon, it uses a set of rules called Automatic Semicolon Insertion to determine whether or not it should regard that line break as the end of a statement, and (as the name implies) place a semicolon into your code before the line break if it thinks so. ASI contains a few eccentric behaviors, though, and your code will break if JavaScript misinterprets your line break. These rules will become more complicated as new features become a part of JavaScript. Explicitly terminating your statements and configuring your linter to catch missing semicolons will help prevent you from encountering issues.\n\n```js\n// bad\nconst name = \"ESLint\";\nlet object = {};\n\nobject.method = function () {\n  // ...\n};\n\n// good\nconst name = \"ESLint\";\nlet object = {};\n\nobject.method = function () {\n  // ...\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003espace-before-function-paren\u003c/summary\u003e\n\nDon't put a space before the `(` of arguments.\n\n```js\n// bad\nfunction foo() {\n  // ...\n}\n\nconst bar = function () {\n  // ...\n};\n\n// good\nfunction foo() {\n  // ...\n}\n\nconst bar = function () {\n  // ...\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003espace-infix-ops\u003c/summary\u003e\n\nPut spaces around infix operators.\n\n```js\n// bad\na + b;\n\na + b;\n\na ? b : c;\n\nconst a = { b: 1 };\n\n// good\na + b;\n\na ? b : c;\n\nconst a = { b: 1 };\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003earrow-body-style\u003c/summary\u003e\n\nDisallow the use of braces around arrow function body as needed. One-liners can be more readable!\n\n```js\n// bad\nlet foo = () =\u003e {\n  return 0;\n};\nlet foo = () =\u003e {\n  return {\n    bar: {\n      foo: 1,\n      bar: 2,\n    },\n  };\n};\n\n// good\nlet foo = () =\u003e 0;\nlet foo = (retv, name) =\u003e {\n  retv[name] = true;\n  return retv;\n};\nlet foo = () =\u003e ({\n  bar: {\n    foo: 1,\n    bar: 2,\n  },\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003earrow-parens\u003c/summary\u003e\n\nOmit parens when there is only one argument. Unnecessary parens make code less readable.\n\n```js\n// bad\n(a) =\u003e {};\n(a) =\u003e a;\n(a) =\u003e {\n  \"\\n\";\n};\na.then((foo) =\u003e {});\na.then((foo) =\u003e a);\na((foo) =\u003e {\n  if (true) {\n  }\n});\n\n// good\n() =\u003e {};\n(a) =\u003e {};\n(a) =\u003e a;\n() =\u003e {\n  \"\\n\";\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003earrow-spacing\u003c/summary\u003e\n\nPut spaces before and after an arrow function’s arrow.\n\n```js\n// bad\n() =\u003e {};\n() =\u003e {};\n(a) =\u003e {};\n(a) =\u003e {};\n\n// good\n() =\u003e {};\n(a) =\u003e {};\n(a) =\u003e a;\n() =\u003e {\n  \"\\n\";\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eno-duplicate-imports\u003c/summary\u003e\n\nAll imports from a single module should exist in a single import statement.\n\n```js\n// bad\nimport { merge } from \"module\";\nimport something from \"another-module\";\nimport { find } from \"module\";\n\n// good\nimport { merge, find } from \"module\";\nimport something from \"another-module\";\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eno-useless-constructor\u003c/summary\u003e\n\nDon't include useless class constructors that can be safely removed without changing how the class works.\n\n```js\n// bad\nclass A {\n  constructor() {}\n}\n\nclass A extends B {\n  constructor(...args) {\n    super(...args);\n  }\n}\n\n// good\n\nclass A {\n  constructor() {\n    doSomething();\n  }\n}\n\nclass A extends B {\n  constructor() {\n    super(\"foo\");\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eno-var\u003c/summary\u003e\n\nUse `let` or `const` instead of `var`.\n\n\u003e Why? ECMAScript 6 allows programmers to create constiables with block scope instead of function scope using the `let` and `const` keywords.\n\n```js\n// bad\nvar x = y;\nvar CONFIG = {};\n\n// good\nlet x = y;\nconst CONFIG = {};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eprefer-const\u003c/summary\u003e\n\nUse `const` instead of `let` when a constiable is never reassigned.\n\n\u003e Why? If a constiable is never reassigned, using the `const` declaration is better.\n\u003e `const` declaration tells readers, “this constiable is never reassigned,” reducing cognitive load and improving maintainability.\n\n```js\n// bad\n\n// it's initialized and never reassigned.\nlet a = 3;\nconsole.log(a);\n\nlet a;\na = 0;\nconsole.log(a);\n\n// good\n\n// it's reassigned after initialized.\nlet a;\na = 0;\na = 1;\nconsole.log(a);\n\n// it's initialized in a different block from the declaration.\nlet a;\nif (true) {\n  a = 0;\n}\nconsole.log(a);\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eprefer-template\u003c/summary\u003e\n\nUse template literals instead of string concatenation.\n\n```js\n// bad\nconst str = \"Hello,\" + name + \"!\";\nconst str = \"Time: \" + 12 * 60 * 60 * 1000;\n\n// good\nconst str = \"Hello World!\";\nconst str = `Hello, ${name}!`;\nconst str = `Time: ${12 * 60 * 60 * 1000}`;\n```\n\n\u003c/details\u003e\n\n## Overriding Rules\n\nIf you'd like to override any rules, you can add the rules to your `.eslintrc` file.\n\n```json\n{\n  \"root\": true,\n  \"extends\": \"@upstatement\",\n  \"rules\": {\n    \"no-console\": \"off\"\n  }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupstatement%2Feslint-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupstatement%2Feslint-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupstatement%2Feslint-config/lists"}