@pedroaal/eslint-config
v1.0.6
Published
The shared eslint configuration for personal projects.
Downloads
2
Readme
This is a base configuration for linting personal projects.
Installation and use
Install eslint
and @pedroaal/eslint-config
:
npm i -D eslint @pedroaal/eslint-config
Generate a file .eslintrc.cjs
with the following content:
module.exports = {
root: true,
extends: [
'@pedroaal'
],
}
Extend the rules
To use the extended rules they must be declared in the eslint configuration file: .eslintrc.cjs
.
Frameworks support, one for ReactJS, NextJS and NestJS, SoliJS. Test env support, Jest, Vitest.
You should always import the general rules first and then the extended ones, since the latter overwrite some general rules.
Extend react rules
To correctly use the general rules of eslint and react, it must be imported as follows in the same order presented:
module.exports = {
root: true,
extends: [
'@pedroaal', '@pedroaal/eslint-config/react'
]
}
Extend nest rules
To correctly use the general rules of eslint and nest, it must be imported as follows in the same order presented:
module.exports = {
root: true,
extends: [
'@pedroaal', '@pedroaal/eslint-config/nest'
]
}
Extend next rules
To use the rules correctly, they must be extended from the general rules, react and next. In this same order.
module.exports = {
root: true,
extends: [
'@pedroaal', '@pedroaal/eslint-config/react', '@pedroaal/eslint-config/next'
]
}
Extend solid rules
To use the rules correctly, they must be extended from the general rules, react and next. In this same order.
module.exports = {
root: true,
extends: [
'@pedroaal', '@pedroaal/eslint-config/solid'
]
}
Extend jest rules
To use the rules correctly, they must be extended from the general rules, react and next. In this same order.
module.exports = {
root: true,
extends: [
'@pedroaal', '@pedroaal/eslint-config/jest'
]
}
Extend vitest rules
To use the rules correctly, they must be extended from the general rules, react and next. In this same order.
module.exports = {
root: true,
extends: [
'@pedroaal', '@pedroaal/eslint-config/vitest'
]
}
Note: the .cjs
extension allows you to tell node that it has to import this file as a CommonJS module and not as an ES Module.
See this issue.