eslint-config-un v0.7.0
eslint-config-un
Grown out of the personal collection of rules, an ESLint config aspiring to cover as many rules as possible, be reasonably strict and easily configurable. Only supports ESLint 9 and the flat config format.
Installation
npm i -D eslint-config-un
pnpm i -D eslint-config-un
yarn add -D eslint-config-unList of configs
Includes the rules from the following configs & plugins:
- Vanilla ESLint rules
- eslint-config-prettier to disable Prettier-incompatible rules
- typescript-eslint
- vue (+ vuejs-accessibility and pinia)
- unicorn
- node (
eslint-plugin-nwithnodeprefix) - import (
eslint-plugin-import-xwithimportprefix) - promise
- regexp
- security
- sonar (v3 since v0.4.0, v1 before)
- tailwind
- jsonc (since v0.1.4)
- yaml (since v0.1.0)
- toml (since v0.1.3)
- prefer-arrow-functions (since v0.1.0)
- eslint-comments (since v0.1.3)
- package-json (since v0.1.5)
- markdown (since v0.2.0)
cssInJs(since v0.2.0), usingeslint-plugin-css- jest (+ jest-extended) (since v0.3.0)
- vitest (since v0.3.0)
- jsdoc (since v0.3.1)
- perfectionist (since v0.4.0)
- de-morgan (since v0.5.0)
- qwik (since v0.6.0)
- json-schema-validator (since v0.6.0)
angular(since v0.7.0), using@angular-eslint/eslint-pluginand@angular-eslint/eslint-plugin-templatecss(since v0.7.0), using@eslint/cssnoUnusedImports(since v0.7.0), usingeslint-plugin-unused-imports
Features
- Automatically detects the presence of
typescript,vue,nuxt,pinia,jest,jest-extended,vitest,@builder.io/qwik,@qwik.dev/coreand@angular/corepackages and enables corresponding configurations (which can also be enabled or disabled explicitly). - Every block of rules supports
overridesfor rules. - Designed to be used separately from Prettier: almost all the rules potentially conflicting with Prettier are disabled by default.
- Written in TypeScript so all the options are typed.
Usage
In your eslint.config.[cm]?js:
// @ts-check
import {eslintConfig} from 'eslint-config-un';
export default eslintConfig({
// your configuration (optional)
});Notes
- You don't need to install any of the mentioned configs/plugins as they are all the dependencies of this package.
- This package has a peer dependency of
eslint>=9. Please ensure you have installed the correct version. Some package managers are installing non-optional peer dependencies automatically. - Packages lookup (such as
typescriptorvue) is performed usinglocal-pkg. - Type-checked, or type-aware TypeScript rules are enabled by default which are known to be performance-demanding. It's just a little heads-up and you should make your own decision whether to keep them enabled. More about type-aware linting.
- By default, TypeScript rules will be enabled in
.vuefiles ifenforceTypescriptInScriptSectionis set to true in vue's config options which in turn is automatically set to true iftypescriptpackage found installed. If you have.vuefiles authored in both TypeScript and JavaScript, useenforceTypescriptInScriptSection.{files,ignores}to manually specify TS & JS Vue components respectively. It is not currently possible to apply different ESLint rules depending on the value oflangattribute of<script>SFC section. - All configs listed above are enabled by default or enabled automatically under certain conditions, but there is some that are disabled by default:
preferArrowFunctionssecurityjsonyamltomlpackageJsonperfectionistdeMorganjsonSchemaValidator
- Some rules are set to warn by default. You can change some or even all such rule's reporting level using
errorsInsteadOfWarningsoption. You can find all such rules by inspecting the source code of this package.
Certain rules are disabled for code blocks inside *.md files
If markdown config is enabled (which is the default), the same rules provided by other configs will be applied to code blocks (`lang ... `) inside Markdown files. This works because under the hood the plugin @eslint/markdown that provides that functionality will create virtual files for each code block with the same extension as specified after `.
But applying certain rules for code blocks might not be desirable because some of them are too strict for the code that won't be executed anyway or even unfixable (like missing imports). You can find the full list of disabled rules in src/configs/markdown.ts file.
Troubleshooting
TypeError: Key languageOptions: Key globals: Global AudioWorkletGlobalScope has leading or trailing whitespace.
Install globals package as a dev dependency.
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago