3
votes

I'm getting started with Walmart's new React framework called Electrode.

I'm trying to configure eslint and have tried extending the walmart lint configuration like so:

https://github.com/walmartlabs/eslint-config-walmart

Here's the .eslintrc

{
    "parser": "babel-eslint",
    "ecmaFeatures": {
      "jsx": true
    },
    "env": {
        "es6": true
    },
    "extends": "walmart/configurations/es6-react-test",
    "rules": {
        "indent": ["error", 2]
    }
}

and package.json

"devDependencies": {
    "babel-eslint": "^7.1.1",
    "electrode-archetype-react-app-dev": "^1.0.0",
    "eslint": "^2.10.2",
    "eslint-plugin-filenames": "^1.0.0",
    "eslint-plugin-react": "^5.1.1",
    "gulp": "^3.9.1"
  },

but I get a definition for rule 'filenames/match-regex' was not found error. I installed eslint-plugin-filenames, was there something else I need to confgure as well?

file: 'file:///foo/client/components/home.jsx'
severity: 'Error'
message: 'Definition for rule 'filenames/match-regex' was not found (filenames/match-regex)'
at: '1,1'
source: 'eslint'
2
Try adding this to your .eslintrc: "plugins": [ "filenames" ], - Aurora0001

2 Answers

1
votes

Try running ESLint from your node_modules instead of the one you have installed globally. Something like this:

node_modules/eslint/bin/eslint.js --fix .

Otherwise your ESLint plugins might not get picked up.

0
votes

Try upgrading the packages, I don't see any such issues now with the new versions.

For configuring/overriding default eslint config refer the Electrode docs

For example to override default eslint config for client(react), I created a .eslintec file in client folder, with below snippet:

---
extends:
  - "../../node_modules/electrode-archetype-react-app-dev/config/eslint/.eslintrc-react"
  - "eslint:recommended"

parser: 
  "babel-eslint"

rules:
  quotes:
    - 2
    - "single"