M
M
Maxim Korolsky2016-05-28 17:56:54
React
Maxim Korolsky, 2016-05-28 17:56:54

How to exclude React modules from eslint?

{
  "extends": [ "eslint-config-lifograph"],

  "globals": {
    "React": true
  },

  "parser": "babel-eslint",
  
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true,
      "modules": true
    }
  },
  "env": {
    "es6": true,
    "browser": true,
    "node": true
  },
  "rules": {
    "spaced-comment": 0,
    "semi": 0,
    "quote-props": 0,
    "semi-spacing": 1,
    "yoda": 1,
    "max-len": 1,
    "no-shadow": 1,
    "one-var": 1,
    "no-unused-vars": [1, {"ignore": ["React", "Modal"]}],
    "key-spacing": 1,
    "space-infix-ops": 1,
    "brace-style": 1,
    "no-undef": 1,
    "no-param-reassign": 1,
    "no-lonely-if": 1,
    "wrap-iife": 1,
    "curly": 1,
    "no-multi-spaces": 1,
    "no-mixed-spaces-and-tabs": 1,
    "no-extra-semi": 1,
    "no-floating-decimal": 1,
    "no-sequences": 1,
    "no-unused-expressions": 1,
    "new-parens": 1,
    "no-unreachable": 1,
    "no-extra-boolean-cast": 1,
    "operator-assignment": 1,
    "guard-for-in": 1,
    "eol-last": 0,
    "space-before-blocks": 0,
    "space-before-function-paren": 0,
    "eqeqeq": 0,
    "no-spaced-func": 0,
    "no-return-assign": 1,

    "react/display-name": 0,
    "react/jsx-boolean-value": 1,
    "react/jsx-no-undef": 1,
    "react/jsx-quotes": 1,
    "react/jsx-sort-prop-types": 1,
    "react/jsx-sort-props": 0,
    "react/jsx-uses-react": 1,
    "react/jsx-uses-vars": 1,
    "react/no-did-mount-set-state": 0,
    "react/no-did-update-set-state": 0,
    "react/no-multi-comp": 0,
    "react/no-unknown-property": 1,
    "react/prop-types": 0,
    "react/react-in-jsx-scope": 1,
    "react/self-closing-comp": 1,
    "react/sort-comp": 1,
    "react/wrap-multilines": 1
  },
  "plugins": [ "react" ]
}

It doesn't work like that, it still returns a warning like this
22:33  warning  'profileState' is defined but never used              no-unused-vars

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Maxim, 2016-05-29
@SuperPosan

Just in case, I'll throw off my config.

{
  "extends": "eslint:recommended",
  "parser": "babel-eslint",
  "env": {
    "browser": true,
    "node": true,
    "mocha": true
  },
  "plugins": [
    "react"
  ],
  "rules": {
    "no-debugger": 0,
    "no-console": 0,
    "no-case-declarations": 0,
    "new-cap": 0,
    "strict": 0,
    "no-underscore-dangle": 0,
    "no-use-before-define": 0,
    "eol-last": 0,
    "quotes": [2, "single"],
    "comma-dangle": [1, "always-multiline"],
    "jsx-quotes": [1, "prefer-single"],
    "react/jsx-no-undef": 2,
    "react/jsx-uses-react": 1,
    "react/jsx-uses-vars": 1
  }
}

T
timfcsm, 2016-05-28
@timfcsm

just do not lint libraries, but give him only your code

Z
zhiga, 2017-01-22
@zhiga90

it looks like a config, as an option you can make a separate config folder to include it eslint ignore

I
Islam Ibakaev, 2017-04-02
@devellopah

create a file .eslintignoreand write the paths to the folders that contain the code that you do not want to lint

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question