@samitouri / QOS-React-2 / commits / 30cce21ae6

Load custom eslint rules as plugin, w/o --rulesdir

This allows us to load the eslint rules without requiring command-line arguments, which avoids breaking editors with eslint plugins. https://github.com/eslint/eslint/issues/2180#issuecomment-87722150

Benjamin Woodruff committed Jun 4, 2015 at 17:04 UTC 30cce21ae6c4e960ea629908fc8c307e41e2bae8
6 files changed +20 -2
.eslintrc
+2 -1
@@ -3,6 +3,7 @@ parser: babel-eslint
3
4 plugins:
5 - react
6 + - react-internal
7
8 env:
9 browser: true
@@ -97,4 +98,4 @@ rules:
98
99 # CUSTOM RULES
100 # the second argument of warning/invariant should be a literal string
100 - warning-and-invariant-args: 2
101 + react-internal/warning-and-invariant-args: 2
eslint-rules/README.md new
+5
@@ -0,0 +1,5 @@
1 +# Custom ESLint Rules
2 +
3 +This is a dummy npm package that allows us to treat it as an eslint-plugin. It's not actually published, nor are the rules here useful for users of react. If you want to lint your react code, try <https://github.com/yannickcr/eslint-plugin-react>.
4 +
5 +**If you modify this rule, you must re-run `npm install ./eslint-rules` for it to take effect.**
eslint-rules/index.js new
+7
@@ -0,0 +1,7 @@
1 +'use strict';
2 +
3 +module.exports = {
4 + rules: {
5 + 'warning-and-invariant-args': require('./warning-and-invariant-args'),
6 + },
7 +};
eslint-rules/package.json new
+4
@@ -0,0 +1,4 @@
1 +{
2 + "name": "eslint-plugin-react-internal",
3 + "version": "0.0.0"
4 +}
grunt/tasks/eslint.js
+1 -1
@@ -6,7 +6,7 @@ module.exports = function() {
6 var done = this.async();
7 grunt.util.spawn({
8 cmd: 'node_modules/.bin/eslint',
9 - args: ['.', '--rulesdir=eslint-rules'],
9 + args: ['.'],
10 opts: {stdio: 'inherit'}, // allows colors to passthrough
11 }, function(err, result, code) {
12 if (err) {
package.json
+1
@@ -41,6 +41,7 @@
41 "es5-shim": "^4.0.0",
42 "eslint": "^0.21.2",
43 "eslint-plugin-react": "^2.5.0",
44 + "eslint-plugin-react-internal": "file:eslint-rules",
45 "eslint-tester": "^0.7.0",
46 "grunt": "~0.4.2",
47 "grunt-cli": "^0.1.13",