Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Add lodash plugin and configure it #2

Open
szydan opened this issue Jun 13, 2019 · 0 comments
Open

Add lodash plugin and configure it #2

szydan opened this issue Jun 13, 2019 · 0 comments
Assignees

Comments

@szydan
Copy link
Contributor

szydan commented Jun 13, 2019

I found this plugin
https://github.com/wix/eslint-plugin-lodash
which can help us a lot to spot lodash mistakes
and force us to not use deprecated APIs etc

I am testing it locally and once most of the lodash3 -> lodash4 issues are resolved in
https://github.com/sirensolutions/kibi-internal/issues/9687
I will be adding the configuration here

Example snippet to add

parser: 'babel-eslint',
plugins: ['lodash'],
extends: ['plugin:lodash/v3'],

rules: [
    ....
    //disable some of the lodash prefare rules
    "lodash/prefer-lodash-method": [2, {"ignoreMethods": [
      "find", "map", "filter", "noop", "assign", "findIndex", "includes", "forEach", "keys", "isError",
      "split", "noop", "trim", "reduce", "startsWith", "reduce", "values", "some", "every", "repeat", "isArray",
      "create", "fill", "endsWith",
    ]}],
    "lodash/prefer-lodash-typecheck": 0,
    "lodash/prefer-reject": 0,
    "lodash/prefer-noop": 0,
    "lodash/prefer-includes": 0,
    "lodash/prefer-constant": 0,
    "lodash/import-scope": 0,
    "lodash/prefer-startswith": 0,
    "lodash/path-style": 0,
    "lodash/consistent-compose": 0,

    // enable later
    "lodash/preferred-alias": 0,
    "lodash/prefer-compact": 0,
    "lodash/matches-prop-shorthand": 0,
    "lodash/prefer-lodash-chain": 0,
    "lodash/chain-style": 0,
    "lodash/prefer-get": 0,
    "lodash/prefer-map": 0,
    "lodash/prefer-filter": 0,
    "lodash/prop-shorthand": 0,
    "lodash/chaining": 0,
    "lodash/prefer-times": 0,
    "lodash/prefer-matches": 0,
    "lodash/matches-shorthand": 0,
    "lodash/prefer-thru": 0,
    "lodash/prefer-some": 0,
    "lodash/prefer-wrapper-method": 0,
    "lodash/collection-method-value": 0,
    "lodash/identity-shorthand": 0,
    ....
]


to run it we have to bump eslint version to 5.16.0 and also 
comment out
'bin',
'config',

in kibi-internal/src/dev/default_eslint_paths.js
  
  
@szydan szydan self-assigned this Jun 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant