Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint internal scripts with eslint:recommended #1729

Merged
merged 2 commits into from
Mar 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{
"extends": "react-app"
"extends": "eslint:recommended",
"env": {
"browser": true,
"commonjs": true,
"node": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 6
},
"rules": {
"no-console": "off",
"strict": ["error", "global"]
}
}
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
"test": "node packages/react-scripts/scripts/test.js --env=jsdom"
},
"devDependencies": {
"babel-eslint": "7.1.0",
"eslint": "3.16.1",
"eslint-config-react-app": "0.6.0",
"eslint-plugin-flowtype": "2.21.0",
"eslint-plugin-import": "2.0.1",
"eslint-plugin-jsx-a11y": "4.0.0",
"eslint-plugin-react": "6.4.1",
"lerna": "2.0.0-beta.38",
"lerna-changelog": "^0.2.3"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-config-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

// Inspired by https://github.com/airbnb/javascript but less opinionated.

// We use eslint-loader so even warnings are very visible.
Expand Down
2 changes: 2 additions & 0 deletions packages/react-dev-utils/checkRequiredFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

var fs = require('fs');
var path = require('path');
var chalk = require('chalk');
Expand Down
2 changes: 2 additions & 0 deletions packages/react-dev-utils/clearConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

function clearConsole() {
process.stdout.write(process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H');
}
Expand Down
2 changes: 2 additions & 0 deletions packages/react-dev-utils/formatWebpackMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

// WARNING: this code is untranspiled and is used in browser too.
// Please make sure any changes are in ES5 or contribute a Babel compile step.

Expand Down
11 changes: 11 additions & 0 deletions packages/react-dev-utils/getProcessForPort.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

var chalk = require('chalk');
var execSync = require('child_process').execSync;
var path = require('path');
Expand Down
2 changes: 2 additions & 0 deletions packages/react-dev-utils/openBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

var execSync = require('child_process').execSync;
var opn = require('opn');

Expand Down
4 changes: 3 additions & 1 deletion packages/react-dev-utils/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

var rl = require('readline');

// Convention: "no" should be the conservative choice.
Expand Down Expand Up @@ -37,6 +39,6 @@ function prompt(question, isYesDefault) {
return resolve(isYes);
});
});
};
}

module.exports = prompt;
4 changes: 3 additions & 1 deletion packages/react-dev-utils/webpackHotDevClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

// This alternative WebpackDevServer combines the functionality of:
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js
Expand Down Expand Up @@ -323,4 +325,4 @@ function tryApplyUpdates(onHotUpdateSuccess) {
}
);
}
};
}
4 changes: 2 additions & 2 deletions packages/react-scripts/bin/react-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ case 'test':
{stdio: 'inherit'}
);
if (result.signal) {
if (result.signal == 'SIGKILL') {
if (result.signal === 'SIGKILL') {
console.log(
'The build failed because the process exited too early. ' +
'This probably means the system ran out of memory or someone called ' +
'`kill -9` on the process.'
);
} else if (result.signal == 'SIGTERM') {
} else if (result.signal === 'SIGTERM') {
console.log(
'The build failed because the process exited too early. ' +
'Someone might have called `kill` or `killall`, or the system could ' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (process.env.E2E_FILE) {
const markup = fs.readFileSync(file, 'utf8')
getMarkup = () => markup

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

resourceLoader = (resource, callback) => callback(
null,
Expand Down
2 changes: 1 addition & 1 deletion tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ then
fi

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

# ******************************************************************************
# First, test the create-react-app development environment.
Expand Down