1

I have installed eslint to clean up my code. I cd to the project folder and launch eslint with npm run pretest, which is

"pretest": "eslint --ignore-path .gitignore ."

it checks only webpack.config.js, that's in the project folder root, but omits the src folder, where the all the code is located.

When I cd to the folder src and launch eslint, nothing happens, it just prints out

frontend@1.0.0 pretest /media/domanski/Domanski/9_Sandbox/react/itunes_search_api/frontend eslint --ignore-path .gitignore .

and gets back to previous line.

Here's my code eslintrc.js for reference:

module.exports = {
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true
    },
    "extends": [
        "eslint:recommended",
        'plugin:react/recommended',
        'airbnb'
    ],
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 2018,
        "sourceType": "module",
        "allowImportExportEverywhere": false,
        "codeFrame": true
    },
    "plugins": [
        "react",
        "jsx-a11y",
        "import"
    ],
    "rules": {
        "indent": ["error", 4, {
            "ignoredNodes": ['JSXElement', 'JSXElement > *',
                'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName',
                'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer',
                'JSXOpeningElement', 'JSXClosingElement', 'JSXText', 'JSXEmptyExpression',
                'JSXSpreadChild'
            ]
        }],
        "jsx-a11y/label-has-for": [2, {
            "components": ["Label"],
            "required": {
                "every": ["nesting", "id"]
            },
            "allowChildren": false
        }],
        "react/jsx-indent": ['error', 4],
        "react/jsx-one-expression-per-line": 0,
        "object-curly-newline": ["error", {
            "ObjectExpression": "always",
            "ObjectPattern": { "multiline": true }
        }],
        "react/jsx-indent-props": ['error', 4],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "always"
        ],
        "react/jsx-filename-extension": [1, {
            "extensions": [".js", ".jsx"]
        }],


    },
    "parser": "babel-eslint"
};

Thanks!

Dominik Domanski
  • 1,023
  • 2
  • 10
  • 18

1 Answers1

0

managed to launch checking by using command eslint '**/*.jsx'.

Interesting, how can i do it in a more elegant way.

Dominik Domanski
  • 1,023
  • 2
  • 10
  • 18
  • 1
    By default ESLint will only process .js files. You have to tell it that you want to process .jsx files as well by using --ext flag on command line: `eslint --ext .jsx`. – Santiago Pernigotti Nov 17 '18 at 17:26