Skip to content

Commit 1892e2b

Browse files
committed
Clean up lint process so that Lerna runs lint on all packages and eslint is the standard. Incorporate the React ESlint rules as well.
1 parent c6f1377 commit 1892e2b

File tree

67 files changed

+461
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+461
-431
lines changed

.eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
"plugins": [
2020
"react"
2121
],
22+
"extends": [
23+
"eslint:recommended",
24+
"plugin:react/recommended"
25+
],
2226
"rules": {
2327
"react/jsx-uses-vars": 2,
2428
"camelcase": 0,
@@ -59,6 +63,7 @@
5963
"except-parens"
6064
],
6165
"no-constant-condition": 2,
66+
"no-console": 1,
6267
"no-dupe-args": 2,
6368
"no-dupe-keys": 2,
6469
"no-empty": 2,
@@ -98,6 +103,7 @@
98103
"double"
99104
],
100105
"react/jsx-uses-react": 2,
106+
"react/react-in-jsx-scope": 1, // make this a warning for now, until things can be refactored
101107
"semi": [
102108
0,
103109
"always"

packages/babel-plugin-react-server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"scripts": {
1212
"clean": "rm -rf lib npm-debug.log*",
13-
"lint": "eslint src/ test/index.js",
13+
"lint": "eslint src test/index.js",
1414
"build": "../../node_modules/.bin/babel --root-mode upward src -d lib",
1515
"test": "mocha --compilers js:babel-register",
1616
"test:watch": "npm run test -- --watch",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tst
+10-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module.exports = {
2-
plugins: [
3-
require('babel-plugin-react-server'),
4-
require('babel-plugin-transform-runtime'),
5-
],
6-
presets: [
7-
require('babel-preset-es2015'),
8-
require('babel-preset-react'),
9-
require('babel-preset-stage-0'),
10-
],
11-
}
2+
plugins: [
3+
require('babel-plugin-react-server'),
4+
require('babel-plugin-transform-runtime'),
5+
],
6+
presets: [
7+
require('babel-preset-es2015'),
8+
require('babel-preset-react'),
9+
require('babel-preset-stage-0'),
10+
],
11+
};

packages/babel-preset-react-server/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"clean": "rimraf npm-debug.log*",
8+
"lint": "eslint .",
89
"prepublish": "npm run clean"
910
},
1011
"repository": "redfin/react-server",

packages/babel-preset-react-server/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test('module can be required', t => {
77
require('.');
88
t.pass();
99
} catch (e) {
10-
console.error(e);
10+
console.error(e); //eslint-disable-line no-console
1111
t.fail();
1212
}
1313
});
@@ -23,7 +23,7 @@ function readFile(filename) {
2323
return new Promise((resolve, reject) => {
2424
fs.readFile(filename, (err, data) => {
2525
if (err) {
26-
console.error(err);
26+
console.error(err); //eslint-disable-line no-console
2727
reject(err);
2828
} else {
2929
resolve(data.toString());
@@ -33,5 +33,5 @@ function readFile(filename) {
3333
}
3434

3535
function trim(str) {
36-
return str.replace(/^\s+|\s+$/, '');
36+
return str.replace(/^\s+|\s+$/, '');
3737
}

packages/flab/.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
string
2+
LAB.src.js

packages/flab/minify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require("get-stdin")().then(src => console.log(
1+
require("get-stdin")().then(src => console.log( // eslint-disable-line no-console
22
"\n"+
33
"/*! LAB.js (LABjs :: Loading And Blocking JavaScript)\n"+
44
" v2.0.3 (c) Kyle Simpson\n"+

packages/flab/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"build-src": "node stringify.js < LAB.src.js > string/src.js",
1414
"build-min": "node minify.js < LAB.src.js | node stringify.js > string/min.js",
1515
"clean": "rimraf string",
16+
"lint": "eslint .",
1617
"test": "echo \"No tests yet...\""
1718
},
1819
"repository": {

packages/flab/stringify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require("get-stdin")().then(src => console.log(
1+
require("get-stdin")().then(src => console.log( // eslint-disable-line no-console
22
'module.exports = ' + src
33
.replace(/\\/g, '\\\\')
44
.replace(/"/g, '\\"')

packages/react-server-cli/gulpfile.babel.js

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import eslint from "gulp-eslint";
21
import gulp from "gulp";
32
import babel from "gulp-babel";
43
import changed from "gulp-changed";
@@ -14,20 +13,7 @@ gulp.task("default", () => {
1413
.pipe(gulp.dest(dest));
1514
});
1615

17-
gulp.task("eslint", [], () => {
18-
return gulp.src("src/**/*.js")
19-
// eslint() attaches the lint output to the eslint property
20-
// of the file object so it can be used by other modules.
21-
.pipe(eslint())
22-
// eslint.format() outputs the lint results to the console.
23-
// Alternatively use eslint.formatEach() (see Docs).
24-
.pipe(eslint.format())
25-
// To have the process exit with an error code (1) on
26-
// lint error, return the stream and pipe to failOnError last.
27-
.pipe(eslint.failAfterError());
28-
});
29-
30-
gulp.task("test", ["default", "eslint"], () => {
16+
gulp.task("test", ["default"], () => {
3117
return gulp.src("target/__tests__/**/*[Ss]pec.js")
3218
.pipe(jasmine({}));
3319
});

packages/react-server-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"ava-watch": "ava --watch",
88
"build": "gulp",
99
"clean": "rimraf target npm-debug.log*",
10-
"lint": "gulp eslint",
10+
"lint": "eslint src test",
1111
"prepublish": "npm run build",
1212
"test": "ava && gulp test",
1313
"watch": "gulp && gulp watch"
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
routes: {}
2+
routes: {},
33
};
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
undeclaredVariable();
1+
undeclaredVariable(); // eslint-disable-line no-undef

0 commit comments

Comments
 (0)