@gcomas/huenei-eslint v0.0.29
Extend ESLint Configuration
This guide explains how to extend an existing ESLint configuration in your project. By extending a shared or base configuration, you can standardize linting rules across multiple projects while still allowing for customizations.
Installation
npm install @huenei/eslint
Prerequisites
Ensure you have the following installed:
- Node.js: Version 22.6.0 or later.
- npm or yarn: For managing dependencies.
- ESLint: Install locally in your project:
npm install eslint --save-dev
Usage
Customize ESLint Config file
Add the extended configuration to the config file.
eslint.config.js
import hueneiLinter from '@huenei/eslint'
/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] }, // affected extensions
{ languageOptions: { globals: globals.browser } },
...hueneiLinter.plugins, // extends plugins
{
rules: {
...hueneiLinter.rules, // extends rules
},
ignores: ['node_modules', 'dist'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
]
Run ESLint in your project
Add a script to your package.json:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
Then run
npm run lint
Customizing the Configuration
You can override or add specific rules or add more extensions to tailor the ESLint configuration to your project's needs. Place these overrides under the rules section in your .eslint.config.js file.
import hueneiLinter from '@huenei/eslint'
/** @type {import('eslint').Linter.Config[]} */
export default [
{ languageOptions: { globals: globals.browser } },
...hueneiLinter.plugins,
..newExtensions // add more extension rules
{
rules: {
...hueneiLinter.rules,
indent: ['error', 4] // override rules
},
},
]
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago