diff --git a/.gitignore b/.gitignore index 5d151a10..cc99dbd8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules yarn.lock !test/fixtures/project/node_modules +test/fixtures/project/node_modules/.cache .nyc_output coverage diff --git a/config/plugins.js b/config/plugins.js index 7f98d5fc..450eeda9 100644 --- a/config/plugins.js +++ b/config/plugins.js @@ -47,16 +47,24 @@ module.exports = { 'import/no-absolute-path': 'error', 'import/no-webpack-loader-syntax': 'error', 'import/no-self-import': 'error', + + // Enable this sometime in the future when Node.js has ES2015 module support + // 'import/no-cycle': 'error' + 'import/no-useless-path-segments': 'error', 'import/newline-after-import': 'error', 'import/no-amd': 'error', 'import/no-duplicates': 'error', + // Enable this sometime in the future when Node.js has ES2015 module support // 'import/unambiguous': 'error', - // enable this sometime in the future when Node.js has ES2015 module support + + // Enable this sometime in the future when Node.js has ES2015 module support // 'import/no-commonjs': 'error', + // Looks useful, but too unstable at the moment // 'import/no-deprecated': 'error', + 'import/no-extraneous-dependencies': 'error', 'import/no-mutable-exports': 'error', 'import/no-named-as-default-member': 'error', @@ -66,23 +74,32 @@ module.exports = { 'import/no-unassigned-import': ['error', { allow: ['babel-polyfill', '@babel/polyfill', 'babel-register', '@babel/register'] }], + // Redundant with import/no-extraneous-dependencies // 'node/no-extraneous-import': 'error', // 'node/no-extraneous-require': 'error', + // Redundant with import/no-unresolved // 'node/no-missing-import': 'error', // 'node/no-missing-require': 'error', + 'node/no-unpublished-bin': 'error', + // Disabled because they're too annoying, see: // https://github.com/mysticatea/eslint-plugin-node/issues/105 // 'node/no-unpublished-import': ['error', {allowModules: ['electron', 'atom']}], // 'node/no-unpublished-require': ['error', {allowModules: ['electron', 'atom']}], + // Disabled as the rule doesn't allow to exclude compiled sources // 'node/no-unsupported-features': 'error', + 'node/process-exit-as-throw': 'error', + // Disabled as the rule doesn't exclude scripts executed with `node` but not referenced in "bin". See https://github.com/mysticatea/eslint-plugin-node/issues/96 // 'node/shebang': 'error', + 'node/no-deprecated-api': 'error' + // Disabled because it causes too much churn and will be moot when we switch to ES2015 modules // 'node/exports-style': ['error', 'module.exports'] } diff --git a/main.js b/main.js index cf8657ed..5eca96a1 100755 --- a/main.js +++ b/main.js @@ -117,7 +117,7 @@ const {input, flags: opts} = cli; // Make data types for `opts.space` match those of the API // Check for string type because `xo --no-space` sets `opts.space` to `false` if (typeof opts.space === 'string') { - if (/^\d+$/.test(opts.space)) { + if (/^\d+$/u.test(opts.space)) { opts.space = parseInt(opts.space, 10); } else if (opts.space === 'true') { opts.space = true; diff --git a/package.json b/package.json index 8d4e7b1a..b37a5466 100644 --- a/package.json +++ b/package.json @@ -53,17 +53,17 @@ "dependencies": { "arrify": "^1.0.1", "debug": "^3.1.0", - "eslint": "^5.2.0", + "eslint": "^5.3.0", "eslint-config-prettier": "^2.9.0", - "eslint-config-xo": "^0.23.0", + "eslint-config-xo": "^0.24.1", "eslint-formatter-pretty": "^1.3.0", - "eslint-plugin-ava": "^5.0.0", - "eslint-plugin-import": "^2.11.0", + "eslint-plugin-ava": "^5.1.0", + "eslint-plugin-import": "^2.13.0", "eslint-plugin-no-use-extend-native": "^0.3.12", "eslint-plugin-node": "^7.0.0", "eslint-plugin-prettier": "^2.6.0", - "eslint-plugin-promise": "^3.7.0", - "eslint-plugin-unicorn": "^4.0.3", + "eslint-plugin-promise": "^3.8.0", + "eslint-plugin-unicorn": "^5.0.0", "get-stdin": "^6.0.0", "globby": "^8.0.0", "has-flag": "^3.0.0", @@ -85,10 +85,10 @@ "devDependencies": { "ava": "*", "coveralls": "^3.0.0", - "eslint-config-xo-react": "^0.16.0", + "eslint-config-xo-react": "^0.17.0", "eslint-plugin-react": "^7.6.1", "execa": "^0.10.0", - "nyc": "^11.4.1", + "nyc": "^12.0.2", "pify": "^3.0.0", "proxyquire": "^2.0.1", "temp-write": "^3.4.0" diff --git a/test/lint-text.js b/test/lint-text.js index 7a8504b5..04ba21d5 100644 --- a/test/lint-text.js +++ b/test/lint-text.js @@ -74,7 +74,7 @@ test('`ignores` option without filename', t => { fn.lintText(`'use strict'\nconsole.log('unicorn');\n`, { ignores: ['ignored/**/*.js'] }); - }, /The `ignores` option requires the `filename` option to be defined./); + }, /The `ignores` option requires the `filename` option to be defined./u); }); test('JSX support', t => { diff --git a/test/main.js b/test/main.js index b55ab082..0f7385b2 100644 --- a/test/main.js +++ b/test/main.js @@ -27,7 +27,7 @@ test('stdin-filename option with stdin', async t => { input: 'console.log()\n', reject: false }); - t.regex(stdout, /unicorn-file:/); + t.regex(stdout, /unicorn-file:/u); }); test('reporter option', async t => { diff --git a/test/options-manager.js b/test/options-manager.js index 577fec0c..1bfc7e17 100644 --- a/test/options-manager.js +++ b/test/options-manager.js @@ -42,7 +42,7 @@ test('normalizeOpts: falsie values stay falsie', t => { test('buildConfig: defaults', t => { const config = manager.buildConfig({}); - t.true(/[\\/]\.xo-cache[\\/]?$/.test(config.cacheLocation)); + t.true(/[\\/]\.xo-cache[\\/]?$/u.test(config.cacheLocation)); t.is(config.useEslintrc, false); t.is(config.cache, true); t.is(config.baseConfig.extends[0], 'xo/esnext');