diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 5e603ecd193..00000000000 --- a/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "react-app" -} diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000000..a1d904f65bd --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,15 @@ +{ + "extends": "react-app", + "parserOptions": { + "ecmaVersion": 5, + "sourceType": "script", + "ecmaFeatures": { + "jsx": false, + "generators": true, + "impliedStrict": false + } + }, + "rules": { + "strict": ["warn", "safe"] + } +} diff --git a/package.json b/package.json index a9262568d25..48773ac0167 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,13 @@ "test": "node packages/react-scripts/scripts/test.js --env=jsdom" }, "devDependencies": { - "babel-eslint": "6.1.2", - "eslint": "3.5.0", - "eslint-config-react-app": "0.2.1", - "eslint-plugin-flowtype": "2.18.1", - "eslint-plugin-import": "1.12.0", - "eslint-plugin-jsx-a11y": "2.2.2", - "eslint-plugin-react": "6.3.0", + "babel-eslint": "^7.1.1", + "eslint": "^3.15.0", + "eslint-config-react-app": "^0.5.1", + "eslint-plugin-flowtype": "^2.30.0", + "eslint-plugin-import": "^2.2.0", + "eslint-plugin-jsx-a11y": "^2.2.3", + "eslint-plugin-react": "^6.9.0", "lerna": "^2.0.0-beta.37", "lerna-changelog": "^0.2.3" } diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index 8a42f885e31..2c326694bf1 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -6,6 +6,7 @@ * 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 path = require('path'); diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index d93478bc8c9..0d787a67fc5 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -16,6 +16,8 @@ // In the future, we might create a separate list of rules for production. // It would probably be more strict. +'use strict'; + module.exports = { root: true, diff --git a/packages/react-dev-utils/InterpolateHtmlPlugin.js b/packages/react-dev-utils/InterpolateHtmlPlugin.js index 07558f47830..d9f5aae00d3 100644 --- a/packages/react-dev-utils/InterpolateHtmlPlugin.js +++ b/packages/react-dev-utils/InterpolateHtmlPlugin.js @@ -16,6 +16,7 @@ // https://github.com/ampedandwired/html-webpack-plugin#events 'use strict'; + const escapeStringRegexp = require('escape-string-regexp'); class InterpolateHtmlPlugin { diff --git a/packages/react-dev-utils/checkRequiredFiles.js b/packages/react-dev-utils/checkRequiredFiles.js index 69233db4837..55139b0b870 100644 --- a/packages/react-dev-utils/checkRequiredFiles.js +++ b/packages/react-dev-utils/checkRequiredFiles.js @@ -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'); diff --git a/packages/react-dev-utils/clearConsole.js b/packages/react-dev-utils/clearConsole.js index cfd10155167..74336284723 100644 --- a/packages/react-dev-utils/clearConsole.js +++ b/packages/react-dev-utils/clearConsole.js @@ -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'); } diff --git a/packages/react-dev-utils/formatWebpackMessages.js b/packages/react-dev-utils/formatWebpackMessages.js index 88834a9fc62..c697efc9fc0 100644 --- a/packages/react-dev-utils/formatWebpackMessages.js +++ b/packages/react-dev-utils/formatWebpackMessages.js @@ -14,6 +14,8 @@ // This is quite hacky and hopefully won't be needed when Webpack fixes this. // https://github.com/webpack/webpack/issues/2878 +'use strict'; + var friendlySyntaxErrorLabel = 'Syntax error:'; function isLikelyASyntaxError(message) { @@ -106,7 +108,7 @@ function formatMessage(message) { // from user code generated by WebPack. For more information see // https://github.com/facebookincubator/create-react-app/pull/1050 message = message.replace( - /^\s*at\s((?!webpack:).)*:\d+:\d+[\s\)]*(\n|$)/gm, '' + /^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, '' ); // at ... ...:x:y return message; diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index 5540fbad47a..80e78848d68 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -1,3 +1,5 @@ +'use strict'; + var chalk = require('chalk'); var execSync = require('child_process').execSync; var path = require('path'); @@ -58,4 +60,3 @@ function getProcessForPort(port) { } module.exports = getProcessForPort; - diff --git a/packages/react-dev-utils/openBrowser.js b/packages/react-dev-utils/openBrowser.js index a3623515e0a..6041dc4ffbc 100644 --- a/packages/react-dev-utils/openBrowser.js +++ b/packages/react-dev-utils/openBrowser.js @@ -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'); diff --git a/packages/react-dev-utils/prompt.js b/packages/react-dev-utils/prompt.js index 4b1faf9bac8..fd0ca46e5d9 100644 --- a/packages/react-dev-utils/prompt.js +++ b/packages/react-dev-utils/prompt.js @@ -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. diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/webpackHotDevClient.js index 7b1768d8fa0..c2ab5b12953 100644 --- a/packages/react-dev-utils/webpackHotDevClient.js +++ b/packages/react-dev-utils/webpackHotDevClient.js @@ -16,6 +16,8 @@ // that looks similar to our console output. The error overlay is inspired by: // https://github.com/glenjamin/webpack-hot-middleware +'use strict'; + var ansiHTML = require('ansi-html'); var SockJS = require('sockjs-client'); var stripAnsi = require('strip-ansi'); @@ -123,7 +125,7 @@ function showErrorOverlay(message) { }); } -function destroyErrorOverlay() { +function destroyErrorOverlay() { if (!overlayDiv) { // It is not there in the first place. return; diff --git a/packages/react-scripts/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js index 5ed9b244ca6..e614d9b598e 100755 --- a/packages/react-scripts/bin/react-scripts.js +++ b/packages/react-scripts/bin/react-scripts.js @@ -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 ' + diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 86d87d39211..3debc4d01c1 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -15,7 +15,6 @@ var HtmlWebpackPlugin = require('html-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var ManifestPlugin = require('webpack-manifest-plugin'); var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); -var url = require('url'); var paths = require('./paths'); var getClientEnvironment = require('./env'); diff --git a/packages/react-scripts/fixtures/kitchensink/integration/initDOM.js b/packages/react-scripts/fixtures/kitchensink/integration/initDOM.js index 7cf8134b79f..9b6049104f9 100644 --- a/packages/react-scripts/fixtures/kitchensink/integration/initDOM.js +++ b/packages/react-scripts/fixtures/kitchensink/integration/initDOM.js @@ -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, diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 20aa16293e0..c8304878c3e 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -83,7 +83,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. diff --git a/tasks/replace-own-deps.js b/tasks/replace-own-deps.js index 23a3f4a01fe..1e3acd9cfb2 100755 --- a/tasks/replace-own-deps.js +++ b/tasks/replace-own-deps.js @@ -7,6 +7,7 @@ * 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'; // Replaces internal dependencies in package.json with local package paths.