Skip to content

ysoftwareab/eslint-plugin-y

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-y Build Status

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.

Bundles

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

Guiding Principles

"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.

1. Keep It Short

  • lines
  • functions
  • modules

2. Reduce Merge Conflicts

  • do less on the same line
  • break array/object expressions/patterns
  • break import specifiers
  • break conditions

3. Reduce Cognitive Load (via explicit code)

  • even if code becomes more verbose

4. Reduce Dependency (on specific ecma versions)

  • use a transpiler like babel (for syntax)
  • use a utility library like lodash-y (for functionality)

5. Increase Consistency

  • don't use arrow functions when you don't need them
  • don't use template literals when you don't need them

References to conventions that cannot/will not be put into eslint rules

Backwards compatibility

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/.

License

UNLICENSE