The ESLint plugin used within Y Software AB.
In your project's .eslintrc.js
module.exports = {
extends: [
'plugin:y/recommended-node'
],
rules: {
'override-some-rule': error
}
}
Optionally, you can run node_modules/eslint-plugin-y/npm-install-peer-dependencies
in order to install the required peer dependencies.
If you want to use an addon, it's as easy as doing this in .eslintrc.js
:
module.exports = {
extends: [
'plugin:y/recommended-node',
'plugin:y/jest'
],
rules: {
'override-some-rule': error
}
}
and running npm install --dev eslint-plugin-jest
.
Common bundles are provided as following:
- Node.js:
plugin:y/recommended-node
- Node.js and Typescript:
plugin:y/recommended-node-typescript
- Browser:
plugin:y/recommended-browser
- Browser and TypeScript:
plugin:y/recommended-browser-typescript
These addons require you to install the plugin manually:
@typescript-eslint/eslint-plugin
:plugin:y/typescript
eslint-plugin-jasmine
:plugin:y/jasmine
eslint-plugin-jest
:plugin:y/jest
eslint-plugin-protractor
:plugin:y/protractor
eslint-plugin-vue
:plugin:y/vue
"I (don't) like/want ..." is no argument in this codebase. Instead, we follow a few guiding principles that have concrete consequences on daily work.
- lines
- functions
- modules
- do less on the same line
- break array/object expressions/patterns
- break import specifiers
- break conditions
- even if code becomes more verbose
- use a transpiler like babel (for syntax)
- use a utility library like lodash-y (for functionality)
- don't use arrow functions when you don't need them
- don't use template literals when you don't need them
- https://www.robinwieruch.de/javascript-naming-conventions
- Not strictly related to eslint/style, but when writing TypeScript, see our guideline.
In March 2021, repositories got renamed
eslint-config-y
->eslint-plugin-y
(this one)eslint-plugin-y
->eslint-plugin-y-deprecated
(this one)
The reason for this change was because ESlint can now store and reference configs inside a plugin, and because npm@7 has a backward incompatible change to auto-install peer dependencies, while the previous setup only works on the assumption that peer dependencies are not automatically installed.
Github's behaviour is to redirect when renaming, so currently both ysoftwareab/eslint-config-y
and ysoftwareab/eslint-plugin-y
are pointing to the same content of this repository.
So for backwards compatibility,
the v0.0.x and v0.1.x tags are from the original eslint-plugin-y
,
now called eslint-plugin-y-deprecated
,
while the v0.0.x and v0.1.x tags of the original eslint-config-y
have been namespaced with config/
.