Skip to content

Commit

Permalink
Enhance node esling config
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Nason committed Jul 24, 2017
1 parent 99c0466 commit 83e31fa
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ eslint-config-wework
# Introduction

ESLint config for WeWork projects. This is an extension of `eslint-config-airbnb` and also provides `react`, `imports`, `lodash`, `mocha`, and `node-security` presets.
ESLint config for WeWork projects. This is an extension of `eslint-config-airbnb` and also provides `react`, `imports`, `lodash`, `mocha`, and `node` presets.


# Usage
Expand Down Expand Up @@ -111,21 +111,21 @@ To enable linting of Mocha/Chai/Sinon tests add a eslintrc file to your test fol
}
```

### Node Security:
To enable identification of security hotspots add a eslintrc file to your node src folder:
### Node:
For Node specific config, including identification of security hotspots, add a eslintrc file to your node src folder:

```
{
"extends": [
"wework/node-security",
"wework/node",
],
"rules": {
# Override preset rules here
},
}
```

Note: this plugin is slow, finds a lot of false positives which need triage by a human, and isn't geared towards client-side. Use sparingly!
Note: the security plugin is slow, finds a lot of false positives which need triage by a human, and isn't geared towards client-side. Use sparingly!
See https://github.com/nodesecurity/eslint-plugin-security for more info.

# Development
Expand Down
14 changes: 0 additions & 14 deletions node-security.js

This file was deleted.

24 changes: 24 additions & 0 deletions node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Config for Node projects
//
// Note this includes the `security` plugin to help identify security hotspots
// This plugin is slow, finds a lot of false positives which need triage by a human,
// and is not useful on the client-side!

module.exports = {
plugins: [
'node',
'security',
],
extends: [
'plugin:node/recommended',
'plugin:security/recommended',
],

rules: {
// Disable https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features.md
// since projects have vastly different setups. Reccomend re-configuring in individual projects.
'node/no-unsupported-features': 0,
},
};


2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-lodash": "2.4.4",
"eslint-plugin-mocha": "4.11.0",
"eslint-plugin-node": "5.1.1",
"eslint-plugin-react": "7.1.0",
"eslint-plugin-security": "1.4.0"
},
Expand All @@ -54,6 +55,7 @@
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-lodash": "2.4.4",
"eslint-plugin-mocha": "4.11.0",
"eslint-plugin-node": "5.1.1",
"eslint-plugin-react": "7.1.0",
"eslint-plugin-security": "1.4.0"
}
Expand Down
13 changes: 11 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,15 @@ eslint-plugin-mocha@4.11.0:
dependencies:
ramda "^0.24.1"

eslint-plugin-node@5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-5.1.1.tgz#a7ed956e780c22aef6afd1116005acd82f26eac6"
dependencies:
ignore "^3.3.3"
minimatch "^3.0.4"
resolve "^1.3.3"
semver "5.3.0"

eslint-plugin-react@7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.1.0.tgz#27770acf39f5fd49cd0af4083ce58104eb390d4c"
Expand Down Expand Up @@ -1675,7 +1684,7 @@ resolve-from@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"

resolve@^1.2.0:
resolve@^1.2.0, resolve@^1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5"
dependencies:
Expand Down Expand Up @@ -1743,7 +1752,7 @@ semver-diff@^2.0.0:
dependencies:
semver "^5.0.3"

"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.2.0, semver@^5.3.0:
"semver@2 || 3 || 4 || 5", semver@5.3.0, semver@^5.0.3, semver@^5.1.0, semver@^5.2.0, semver@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"

Expand Down

0 comments on commit 83e31fa

Please sign in to comment.