Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

eslint-config-sweet

robinloeffel188MIT26.0.0TypeScript support: included

ESLint shareable config for the most sweet-ass JavaScript and TypeScript. 🤙🏼

eslint, eslint-config

readme

eslint-config-sweet

latest version on npm npm downloads a month eslint peer dependency typescript peer dependency package license

ESLint shareable config for the most sweet-ass JavaScript and TypeScript. 🤙🏼

Installation

npm i -D eslint-config-sweet eslint typescript

Usage

To use the package, follow the ESLint docs about integrating shareable configs.

import { defineConfig } from "eslint";
import sweet from "eslint-config-sweet";

export default defineConfig(sweet);

Pro Tip for VS Code

To make your experience even better, Microsoft has added a rad feature to VS Code that makes cleaning up import and export statements a breeze! Go to your user settings via ⌘ + ⇧ + p, then type user json, and hit enter. Add "source.organizeImports": "explicit" to "editor.codeActionsOnSave" as seen here in the VS Code docs, and save that bad boy.

Boom, VS Code will now automatically remove unused imports and exports, as well as sort them for ya! 🤙🏼

How will my code look when using this?

Sweet, man. That's the point. On a more serious note though: It mostly, of course, enforces consistency, even though it may not look like it the first few moments. It will make your code feel more lightweight and nudge you towards using more modern APIs and good practices, while maintaining readability and keeping complexity down.

Nice to know

sweet will clash with your Prettier setup, there's no way around it. This config is using @stylistic/eslint-plugin for formatting, and eslint-config-prettier turns off ESLint's built-in, but deprecated, formatting rules.

While I generally agree with the different concerns of linters and formatters, Prettier just isn't configurable enough for my liking. And this is by design, as it is meant to be an opinionated, zero-config, drop-in solution with limited options. Until we have a more flexible formatter available, using ESLint in this way seems to be the way to go.

License

MIT

changelog

changelog

v26.0.0

2025-05-16

  • update @eslint/js
  • upgrade eslint-plugin-unicorn
  • update typescript-eslint
  • clean up deprecated config options
  • add rule @stylistic/func-call-spacing
  • add rule @typescript-eslint/no-unnecessary-type-conversion
  • add rule @typescript-eslint/no-unsafe-type-assertion
  • add rule @typescript-eslint/strict-boolean-expressions

v25.0.0

2025-03-21

  • update eslint-plugin-github to v6

v24.0.0

2025-02-21

  • update dependencies
  • walk back on @stylistic/newline-per-chained-call

v23.0.2

2025-02-16

  • update typescript-eslint to recognize reportUnusedInlineConfigs in typings

v23.0.1

2025-02-08

  • remove sonarjs/no-implicit-dependencies rule

v23.0.0

2025-02-08

  • update dependencies
  • update a bunch of rules
  • re-introduce eslint-plugin-sonarjs
  • add new reportUnusedInlineConfigs config

v22.1.3

2025-01-07

  • update dependencies
  • drop @eslint/compat

v22.1.2

2024-12-18

v22.1.1

2024-12-18

  • directly use return type of config helper as default export type

v22.1.0

2024-12-18

  • add types
  • update dependencies
  • drop @eslint/compat
  • drop dependency overrides
  • only pack necessary files

v22.0.0

2024-10-26

  • move to flat config format
  • drop eslint-plugin-deprecation
  • drop eslint-plugin-sonarjs
  • drop eslint-plugin-yml
  • drop eslint-plugin-jsonc

v21.0.0

2024-07-01

  • this will be the last release supporting eslint@8
  • upgrade @stylistic/eslint-plugin
  • upgrade eslint-plugin-deprecation
  • upgrade eslint-plugin-github
  • upgrade eslint-plugin-sonarjs
  • upgrade eslint-plugin-unicorn
  • add rule @typescript-eslint/consistent-type-assertions
  • add extraFileExtensions to typescript parserOptions
  • run typescript rules on vue, svelte and astro files

v20.0.0

2024-04-05

  • upgrade eslint-plugin-unicorn

v19.0.2

2024-03-05

  • revert @typescript-eslint/consistent-type-imports rule

v19.0.1

2024-03-05

  • remove eslint-plugin-simple-import-sort in favor of vs code's built-in functionality
  • remove eslint-plugin-unused-imports in favor of vs code's built-in functionality
  • tweak @typescript-eslint/consistent-type-imports rule

v19.0.0

2024-03-05

  • use @typescript-eslint/strict-type-checked config
  • add eslint-plugin-simple-import-sort
  • add eslint-plugin-unused-imports
  • add eslint-plugin-yml
  • upgrade @typescript-eslint/eslint-plugin
  • upgrade @typescript-eslint/parser
  • rewrite everything in typescript

v18.0.0

2023-12-02

  • add eslint-plugin-github dependency and rules
  • add eslint-plugin-sonarjs dependency and rules
  • remove sweet/typescript entry (always include ts)

v17.0.1

2023-11-22

  • remove @stylistic/lines-between-class-members rule
  • remove @stylistic/object-property-newline rule

v17.0.0

2023-11-21

  • add @stylistic/eslint-plugin for formatting rules (just can't get used to prettier)

v16.0.3

2023-11-21

  • remove native sort-* again

v16.0.2

2023-11-21

  • remove no-magic-numbers again

v16.0.1

2023-11-21

  • include required files in npm package

v16.0.0

2023-11-21

  • use prettier for formatting internally
  • remove all deprecated formatting rules from config
  • remove eslint-plugin-perfectionist again (was too disruptive, after all)
  • extend from eslint:recommended
  • add native sort-* rules

v15.0.0

2023-11-19

  • add eslint-plugin-deprecation dependency
  • add eslint-plugin-perfectionist dependency
  • add logical-assignment-operators rule
  • add operator-assignment rule

v14.0.0

2023-11-09

  • the strict ts config was a little too strict

v13.0.0

2023-11-04

  • require at least node@18
  • update @typescript-eslint/eslint-plugin dependency
  • update @typescript-eslint/parser dependency
  • update eslint-plugin-unicorn dependency
  • add eslint-plugin-jsonc dependency
  • loosen eslint peer dependency
  • loosen typescript peer dependency
  • directly export typescript config

v12.0.0

2023-08-23

  • require at least node@16
  • update @typescript-eslint/eslint-plugin dependency
  • update @typescript-eslint/parser dependency
  • update eslint-plugin-unicorn dependency
  • update eslint peer dependency
  • update typescript peer dependency
  • clean up rules
  • separate out typescript config
  • introduce typescript-typed config

v11.0.1

2023-03-19

  • clean up dependencies
  • clean up duplicate config props
  • add type hints in config and rule sets

v11.0.0

2023-03-18

  • Switch to plugin:unicorn/recommended for most rules

v10.0.0

2023-03-18

Complete re-write

  • Drop eslint-plugin-compat
  • Drop eslint-plugin-import
  • Drop eslint-plugin-node
  • Add @typescript-eslint/eslint-plugin dependency
  • Add @typescript-eslint/parser dependency
  • Add typescript peer dependency
  • Upgrade eslint-plugin-unicorn dependency
  • Upgrade eslint peer dependency
  • Update rules accordingly
  • Drop sweet/node entry
  • Drop sweet/web entry

v9.0.0

2022-08-30

  • Add prefer-logical-operator-over-ternary rule

v8.0.1

2022-01-11

  • Change no-multiple-empty-lines rule

v8.0.0

2022-01-09

  • Update engines in package.json
  • Change no-multiple-empty-lines rule
  • Add no-array-constructor rule
  • Add no-eval rule
  • Add no-new rule
  • Add no-new-object rule
  • Add no-new-wrappers rule
  • Add no-plusplus rule
  • Add no-proto rule
  • Add no-return-assign rule
  • Add no-trailing-spaces rule
  • Add no-useless-computed-key rule
  • Add operator-linebreak rule
  • Add padded-blocks rule
  • Add unicorn/no-await-expression-member rule

v7.0.0

2021-11-20

  • Upgrade eslint-plugin-compat
  • Upgrade eslint-plugin-import
  • Upgrade eslint-plugin-unicorn
  • Add unicorn/no-empty-file rule
  • Add unicorn/no-invalid-remove-event-listener rule
  • Add unicorn/no-useless-fallback-in-spread rule
  • Add unicorn/prefer-export-from rule
  • Add unicorn/template-indent rule

v6.0.0

2021-09-04

  • Upgrade eslint-plugin-compat
  • Upgrade eslint-plugin-import
  • Upgrade eslint-plugin-unicorn
  • Add unicorn/prefer-at rule
  • Add unicorn/prefer-prototype-methods rule
  • Add unicorn/prefer-array-flat-map rule
  • Add unicorn/prefer-switch rule
  • Add unicorn/no-nested-ternary rule
  • Add unicorn/no-useless-spread rule
  • Add unicorn/no-useless-undefined rule
  • Add unicorn/no-useless-length-check rule
  • Add unicorn/prefer-spread rule
  • Add unicorn/prefer-string-slice rule

v5.0.0

2021-03-26

  • Upgrade eslint-plugin-unicorn
  • Add unicorn/consistent-destructuring rule
  • Add unicorn/no-array-push-push rule
  • Add unicorn/prefer-array-flat rule
  • Add unicorn/prefer-array-index-of rule

v4.0.0

2021-01-05

  • Update eslint-plugin-compat
  • Upgrade eslint-plugin-unicorn
  • Add no-lonely-if rule (error)
  • Add unicorn/no-lonely-if rule (error)
  • Add unicorn/empty-brace-spaces rule (error)
  • Add unicorn/prefer-array-some rule (error)
  • Add unicorn/prefer-date-now rule (error)
  • Add unicorn/prefer-default-parameters rule (error)
  • Refactor eslin-plugin-unicorn rule names

v3.0.1

2020-12-01

  • Recognize more config files

v3.0.0

2020-11-30

  • Add unicorn/prefer-ternary rule
  • Always include the file extension except for js files
  • Make sweet/web the default entry (now only sweet will do the trick)

v2.0.1

2020-10-11

  • Add .eslintrc.js to the array of configs in web.js

v2.0.0

2020-09-29

  • Added: unicorn/prefer-array-find
  • Automatically detect common JS config files and lint them accordingly

v1.1.0

2020-06-07

  • Only enforce array item newlines to be consistent (array-bracket-newline)
  • Only enforce object prop newlines to be consistent (object-curly-newline)

v1.0.0

2020-06-07

  • Breaking Change: Disallow newlines in arrays with less than 3 items (array-bracket-newline)
  • Breaking Change: Disallow newlines in objects with less than 3 props (object-curly-newline)
  • Breaking Addition: Disallow spaces in template tag calls (template-tag-spacing)
  • Breaking Addition: Disallow existence-checking for the length of array-like objects (unicorn/explicit-length-check)

v0.6.2

2020-06-04