1.0.0 • Published 2 months ago

@tim-code/eslint-config v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

eslint-config

npm install --save-dev @tim-code/eslint-config

Then in package.json:

  "eslintConfig": {
    "extends": [
      "@tim-code"
    ],
    "root": true,
    "ignorePatterns": []
  }

This assumes that code can use Node globals unless it is in a frontend directory. See below to change this.

Note that root and ignorePatterns are not required but root is useful to prevent ESLint from searching for more config files and ignorePatterns is often eventually needed to ignore files such as a build directory.

React

To fully support React/JSX, install:

npm install --save-dev eslint-plugin-react

Then in eslintConfig in package.json:

"extends": [
  "@tim-code",
  "plugin:react/recommended"
]

Because null is often used in React code, you may want to disable the warning about null:

"rules": [
  "no-restricted-syntax": "off"
]

Make src directory use "browser" globals instead of "node" globals

In eslintConfig in package.json:

"overrides": [
  {
    "files": [
      "src/**"
    ],
    "env": {
      "node": false,
      "browser": true
    }
  }
]

Instead, if there are no JS files in the project directory that require Node:

"env": {
  "node": false,
  "browser": true
}

Why not eslint-babel?

eslint-babel is a more flexible parser but using it is a bit more complex (requires configuration) and introduces another dependency.

1.0.0

2 months ago

0.8.1

7 months ago

0.8.0

8 months ago

0.7.5

1 year ago

0.7.2

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.7.1

2 years ago

0.6.6

2 years ago

0.7.0

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.1

2 years ago

0.5.10

2 years ago

0.5.11

2 years ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.9

2 years ago

0.5.14

2 years ago

0.5.12

2 years ago

0.6.0

2 years ago

0.3.0

3 years ago

0.5.4

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.3.2

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago