Giter VIP home page Giter VIP logo

eslint-config's Introduction

@voxpelli/eslint-config

npm version npm downloads js-semistandard-style Follow @voxpelli@mastodon.social

My personal ESLint config which extends standard / semistandard with a couple of extra checks that I find helpful in my projects.

Includes the semistandard rules directly rather than relying on eslint-config-semistandard, as that package isn't always trailing the main eslint-config-standard package.

This package follows semantic versioning. Tightening of any checks is a breaking change, therefore that will only happen in major releases. Minor and patch releases will only include relaxation of rules or fixing of minor obvious oversights.

Can I use this in my own project?

Absolutely, go ahead! I maintain this project as if multiple people are using it. Be sure to give me feedback and if you like it, give me a ping and say so, would make my day ๐Ÿ˜„

Usage

Install

Be sure to install the correct versions of peer dependencies that this module requires, else you will likely get an incorrect rule setup.

To easily install all correct peer dependencies, you can use install-peerdeps:

install-peerdeps --dev @voxpelli/eslint-config

Configure

Add an .eslintrc, or other ESLint configuration, that extends this config:

{
  "extends": "@voxpelli",
  "root": true
}

Configure, ESM

Instead of simply extending @voxpelli you can extend @voxpelli/eslint-config/esm and get a version of the rules that enforces ESM best practices as well.

How does this differ from pure standard?

  • ๐Ÿ›‘ = changed to error level
  • โš ๏ธ = changed to warn level
  • ๐Ÿ”‡ = deactivated
  • ๐Ÿ”ง = changed config
  • ๐Ÿ˜ฌ = will not pass vanilla standard linting

๐Ÿ”ง Changed standard rules

  • ๐Ÿ”งโš ๏ธ๐Ÿ˜ฌ comma-dangle โ€“ changed โ€“ prefer dangling commas in everything but functions + is it set to warn rather than error as I gradually move to this setup
  • ๐Ÿ”‡ dot-notation โ€“ deactivated โ€“ clashes with the noPropertyAccessFromIndexSignature check in TypeScript, which I use
  • ๐Ÿ”ง๐Ÿ˜ฌ no-multi-spaces โ€“ changed โ€“ sets ignoreEOLComments to true, can be useful for more readable comments across multiple lines and I see no real downsides to it (Incompatible with standard)
  • ๐Ÿ”ง no-unused-vars โ€“ changed โ€“ sets "args": "all", "argsIgnorePattern": "^_", because I personally don't feel limited by Express error handlers + wants to stay in sync with TypeScript noUnusedParameters
  • ๐Ÿ”ง๐Ÿ˜ฌ semi and no-extra-semi โ€“ changed โ€“ adopts the semicolons setup from semistandard (Incompatible with plain standard, compatible with semistandard)
  • ๐Ÿ”งโš ๏ธ n/no-deprecated-api โ€“ changed โ€“ changed to warn instead of error as often it's not an urgent thing to fix

โž• Added ESLint core rules

  • โš ๏ธ func-style โ€“ disallows function declarations, good to be consistent with how functions are declared
  • โš ๏ธ no-console โ€“ warns on existence of console.log and similar, as they are mostly used for debugging and should not be committed
  • ๐Ÿ›‘ no-constant-binary-expression โ€“ errors when binary expressions are detected to constantly evaluate a specific way
  • ๐Ÿ›‘ no-nonoctal-decimal-escape โ€“ there's no reason not to ban it
  • ๐Ÿ›‘ no-unsafe-optional-chaining โ€“ enforces one to be careful with .? and not use it in ways that can inadvertently cause errors or NaN results
  • โš ๏ธ no-warning-comments โ€“ warns of the existence of FIXME comments, as they should always be fixed before pushing
  • ๐Ÿ›‘ object-shorthand โ€“ requires the use of object shorthands for properties, more tidy
  • ๐Ÿ›‘ quote-props โ€“ requires properties to be quoted when needed but otherwise disallows it

๐Ÿ“ฆ Added ESLint rule package

๐Ÿ”ง Overrides of added ESLint rule packages

โž• Additional standalone ESLint rules

Extended ESM config

By extending @voxpelli/eslint-config/esm instead of @voxpelli you will get these differences:

๐Ÿ”ง Overrides of rules

  • โš ๏ธ func-style โ€“ enforces function declarations whenever an arrow function isn't used. Better to do export function foo () { than export const foo = function () {
  • ๐Ÿ›‘ unicorn/prefer-module โ€“ changed โ€“ restored to its plugin:unicorn/recommended value of error

Alternatives

See also

eslint-config's People

Contributors

github-actions[bot] avatar renovate-bot avatar renovate[bot] avatar voxpelli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eslint-config's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>voxpelli/renovate-config:vpBase)

Add `prefer-object-spread` + `prefer-destructuring`

https://eslint.org/docs/latest/rules/prefer-object-spread
https://eslint.org/docs/latest/rules/prefer-destructuring

And maybe other prefer- rules from: https://eslint.org/docs/latest/rules/

Current prefer rules:

Add `sort-keys`?

   "sort-keys": ["error", "asc", { "natural": true, "allowLineSeparatedGroups": true}]

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/compliance.yml
  • mtfoley/pr-compliance-action 11b664f0fcf2c4ce954f05ccfcaab6e52b529f86
.github/workflows/dependency-review.yml
.github/workflows/external.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
.github/workflows/npm-test.yml
.github/workflows/release-please.yml
.github/workflows/rule-diff.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
npm
package.json
  • eslint-plugin-es-x ^7.6.0
  • eslint-plugin-jsdoc ^48.2.6
  • eslint-plugin-mocha ^10.4.3
  • eslint-plugin-n ^17.7.0
  • eslint-plugin-security ^3.0.0
  • eslint-plugin-sort-destructure-keys ^2.0.0
  • eslint-plugin-unicorn ^53.0.0
  • globals ^15.3.0
  • neostandard ^0.5.0
  • typescript-eslint ^8.0.0-alpha.17
  • @types/eslint ^8.56.10
  • @typescript-eslint/utils ^8.0.0-alpha.20
  • @voxpelli/tsconfig ^12.0.1
  • compare-eslint-configs ^2.1.0
  • eslint ^9.3.0
  • husky ^8.0.3
  • installed-check ^9.3.0
  • knip ^5.17.3
  • list-dependents-cli ^2.2.0
  • npm-run-all2 ^6.2.0
  • ts-ignore-import ^4.0.1
  • type-coverage ^2.28.2
  • typescript ~5.4.5
  • validate-conventional-commit ^1.0.3
  • eslint ^9.0.0
  • node ^18.18.0 || ^20.9.0 || >=21.1.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.