Skip to content

Commit 51b6886

Browse files
gaearonrandycoulman
authored andcommitted
Lint internal scripts with eslint:recommended (facebook#1729)
* Lint internal scripts with eslint:recommended * Warnings r bad
1 parent 22f40e4 commit 51b6886

File tree

14 files changed

+45
-14
lines changed

14 files changed

+45
-14
lines changed

.eslintrc

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
{
2-
"extends": "react-app"
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"browser": true,
5+
"commonjs": true,
6+
"node": true,
7+
"es6": true
8+
},
9+
"parserOptions": {
10+
"ecmaVersion": 6
11+
},
12+
"rules": {
13+
"no-console": "off",
14+
"strict": ["error", "global"]
15+
}
316
}

package.json

-6
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
"test": "node packages/react-scripts/scripts/test.js --env=jsdom"
1212
},
1313
"devDependencies": {
14-
"babel-eslint": "7.1.0",
1514
"eslint": "3.16.1",
16-
"eslint-config-react-app": "0.5.1",
17-
"eslint-plugin-flowtype": "2.21.0",
18-
"eslint-plugin-import": "2.0.1",
19-
"eslint-plugin-jsx-a11y": "4.0.0",
20-
"eslint-plugin-react": "6.4.1",
2115
"lerna": "2.0.0-beta.38",
2216
"lerna-changelog": "^0.2.3"
2317
}

packages/eslint-config-react-app/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10+
'use strict';
11+
1012
// Inspired by https://github.com/airbnb/javascript but less opinionated.
1113

1214
// We use eslint-loader so even warnings are very visible.

packages/react-dev-utils/checkRequiredFiles.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10+
'use strict';
11+
1012
var fs = require('fs');
1113
var path = require('path');
1214
var chalk = require('chalk');

packages/react-dev-utils/clearConsole.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10+
'use strict';
11+
1012
function clearConsole() {
1113
process.stdout.write(process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H');
1214
}

packages/react-dev-utils/formatWebpackMessages.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10+
'use strict';
11+
1012
// WARNING: this code is untranspiled and is used in browser too.
1113
// Please make sure any changes are in ES5 or contribute a Babel compile step.
1214

packages/react-dev-utils/getProcessForPort.js

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
'use strict';
11+
112
var chalk = require('chalk');
213
var execSync = require('child_process').execSync;
314
var path = require('path');

packages/react-dev-utils/openBrowser.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10+
'use strict';
11+
1012
var execSync = require('child_process').execSync;
1113
var opn = require('opn');
1214

packages/react-dev-utils/prompt.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10+
'use strict';
11+
1012
var rl = require('readline');
1113

1214
// Convention: "no" should be the conservative choice.
@@ -37,6 +39,6 @@ function prompt(question, isYesDefault) {
3739
return resolve(isYes);
3840
});
3941
});
40-
};
42+
}
4143

4244
module.exports = prompt;

packages/react-dev-utils/webpackHotDevClient.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10+
'use strict';
11+
1012
// This alternative WebpackDevServer combines the functionality of:
1113
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
1214
// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js
@@ -319,4 +321,4 @@ function tryApplyUpdates(onHotUpdateSuccess) {
319321
}
320322
);
321323
}
322-
};
324+
}

packages/react-scripts/bin/react-scripts.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ case 'test':
1414
{stdio: 'inherit'}
1515
);
1616
if (result.signal) {
17-
if (result.signal == 'SIGKILL') {
17+
if (result.signal === 'SIGKILL') {
1818
console.log(
1919
'The build failed because the process exited too early. ' +
2020
'This probably means the system ran out of memory or someone called ' +
2121
'`kill -9` on the process.'
2222
);
23-
} else if (result.signal == 'SIGTERM') {
23+
} else if (result.signal === 'SIGTERM') {
2424
console.log(
2525
'The build failed because the process exited too early. ' +
2626
'Someone might have called `kill` or `killall`, or the system could ' +

packages/react-scripts/config/webpack.config.prod.js

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
1515
var ExtractTextPlugin = require('extract-text-webpack-plugin');
1616
var ManifestPlugin = require('webpack-manifest-plugin');
1717
var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
18-
var url = require('url');
1918
var paths = require('./paths');
2019
var getClientEnvironment = require('./env');
2120

packages/react-scripts/fixtures/kitchensink/integration/initDOM.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (process.env.E2E_FILE) {
1515
const markup = fs.readFileSync(file, 'utf8')
1616
getMarkup = () => markup
1717

18-
const pathPrefix = process.env.PUBLIC_URL.replace(/^https?:\/\/[^\/]+\/?/, '')
18+
const pathPrefix = process.env.PUBLIC_URL.replace(/^https?:\/\/[^/]+\/?/, '')
1919

2020
resourceLoader = (resource, callback) => callback(
2121
null,

tasks/e2e-simple.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ then
9797
fi
9898

9999
# Lint own code
100-
./node_modules/.bin/eslint --ignore-path .gitignore ./
100+
./node_modules/.bin/eslint --max-warnings 0 --ignore-path .gitignore ./
101101

102102
# ******************************************************************************
103103
# First, test the create-react-app development environment.

0 commit comments

Comments
 (0)