Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Breaking: drop support for Node < 10 #27

Merged
merged 9 commits into from Feb 18, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.yml
Expand Up @@ -9,3 +9,5 @@ rules:
- error
- name: child_process
message: Please use cross-spawn instead.

no-console: off
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock = false
4 changes: 2 additions & 2 deletions .travis.yml
@@ -1,4 +1,4 @@
language: node_js
node_js:
- 6
- 7
- 10
- 12
23 changes: 12 additions & 11 deletions canary.js
Expand Up @@ -41,23 +41,23 @@ function createTempFolder() {
}

/**
* Synchronously spawn a child process, and throw if it exits with an error
* @param {string} command The command to spawn
* @param {string[]} args Arguments for the command
* @returns {void}
*/
* Synchronously spawn a child process, and throw if it exits with an error
* @param {string} command The command to spawn
* @param {string[]} args Arguments for the command
* @returns {void}
*/
function spawn(command, args) {
const result = spawnSync(command, args);

assert.strictEqual(result.status, 0, `The command '${command} ${args.join(" ")}' exited with an exit code of ${result.status}:\n\n${result.output[2].toString()}`);
}

/**
* Determines whether a particular dependency of a project should be installed
* @param {object} projectInfo The project information in the yml file
* @param {string} dependency The name of the dependency
* @returns {boolean} `true` if the dependency should be installed
*/
* Determines whether a particular dependency of a project should be installed
* @param {Object} projectInfo The project information in the yml file
* @param {string} dependency The name of the dependency
* @returns {boolean} `true` if the dependency should be installed
*/
function shouldInstall(projectInfo, dependency) {
return dependency.includes("eslint") && dependency !== "eslint" ||
projectInfo.dependencies && projectInfo.dependencies.indexOf(dependency) !== -1;
Expand Down Expand Up @@ -92,7 +92,7 @@ projects.forEach(projectInfo => {

npmInstallArgs = Array.from(new Set(Object.keys(dependencyVersions).concat(projectInfo.dependencies || [])))
.filter(dependency => shouldInstall(projectInfo, dependency))
.map(dependency => dependencyVersions[dependency] ? `${dependency}@${dependencyVersions[dependency]}` : dependency);
.map(dependency => (dependencyVersions[dependency] ? `${dependency}@${dependencyVersions[dependency]}` : dependency));
}

console.log(`Installing dependencies for ${projectInfo.name}`);
Expand All @@ -110,6 +110,7 @@ projects.forEach(projectInfo => {
console.log(`Linting ${projectInfo.name}`);

const result = spawnSync(eslintBinPath, projectInfo.args.concat("--format=codeframe"));

if (result.status === 0) {
console.log(`Successfully linted ${projectInfo.name} with no errors`);
} else {
Expand Down
16 changes: 9 additions & 7 deletions package.json
Expand Up @@ -21,16 +21,18 @@
},
"homepage": "https://github.com/not-an-aardvark/eslint-canary#readme",
"devDependencies": {
"eslint": "^4.19.1",
"eslint-config-eslint": "^3.0.0",
"npm": "^3.10.10"
"eslint": "^6.8.0",
"eslint-config-eslint": "^6.0.0",
"eslint-plugin-jsdoc": "^18.4.4",
"eslint-plugin-node": "^10.0.0",
"npm": "^6.13.4"
},
"dependencies": {
"chai": "^3.5.0",
"cross-spawn": "^6.0.5",
"js-yaml": "^3.7.0"
"chai": "^4.2.0",
"cross-spawn": "^7.0.1",
"js-yaml": "^3.13.1"
},
"engines": {
"node": ">=6"
"node": ">=10"
}
}
49 changes: 17 additions & 32 deletions projects.yml
Expand Up @@ -9,14 +9,13 @@

- name: body-parser
repo: https://github.com/expressjs/body-parser
commit: b2659a7af3b413a2d1df274bef409fe6cdcf6b8f
commit: b15bae549108e613ceb5e408731cbdb374ad62df
args:
- .
- --rule=indent:off

- name: jquery
repo: https://github.com/jquery/jquery
commit: 3e3b09d68d317a3fe567e377e9032319ac5e0829
commit: c1ee33aded44051b8f1288b59d2efdc68d0413cc
args:
- src/**/*.js
- Gruntfile.js
Expand All @@ -25,60 +24,46 @@

- name: mocha
repo: https://github.com/mochajs/mocha
commit: 09ce746aa925d35317f2624fd36c77a31bb68e24
commit: 883ae4b5e1aacd8cf30694da33b391ce58f4cca8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to ESLint v6 here: mochajs/mocha#4138

args:
- .
- bin/*
- --rule=indent:off
- --rule=no-multi-spaces:[error,{ignoreEOLComments:true}]

- name: node
repo: https://github.com/nodejs/node
commit: 0863a0e528ba9ee01f960dce7ffebe8fff3a774c
commit: 7babffbe6054754b733098c52786a23df4049a74
args:
- --rulesdir=tools/eslint-rules
- benchmark
- lib
- test
- tools
- --rule=indent:off
- --rule=no-multi-spaces:[error, {ignoreEOLComments:true}]
- --rule=timer-arguments:off
- --rule=no-self-assign:[error, {props:false}]

- name: redux
repo: https://github.com/reactjs/redux
commit: ac7cd32a5270eb374611bf73d072e84a1e7567c2
commit: 9819b5ef2909cacda0f09c8d29fde229bd7da5fa
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to ESLint v6 here: reduxjs/redux#3698

args:
- src
- test
- examples
- --ext js,ts
- src/**/*
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails without specifying this glob.

- test/**/*

- name: vue
repo: https://github.com/vuejs/vue
commit: d982e344b39391fe91b6dd91d51b2f0310a45e77
commit: 6390f70c2e4ec7e51cce1d2a4ba35e2d0d328205
args:
- src
- build
- scripts
- test
- --rule=indent:off
- --rule=no-multi-spaces:[error,{ignoreEOLComments:true}]
- --rule=camelcase:off # There are several `camelcase` errors in the vue codebase for some reason
# The Vue codebase has some linting errors in master.
- --rule=no-prototype-builtins:off
- --rule=no-redeclare:off

- name: webpack
repo: https://github.com/webpack/webpack
commit: 95291e83662b2a2a184d492de0451cda27da1279
commit: 9d907c1c3810577dcbb83aad5fb2bc5de093f2bd
args:
- lib
- bin
- hot
- buildin
- test/*.js
- test/**/webpack.config.js
- examples/**/webpack.config.js
- schemas/**/*.js
- --rule=no-self-assign:[error, {props:false}]
- --rule=node/no-missing-require:off # Prevent missing dependencies from erroring
- --rule=prettier/prettier:off # There are several errors with `prettier/prettier`, need to figure out what is missing in config
- .
# Disabling this rule so that we don't have to install all missing dependencies.
- --rule=node/no-missing-require:off
dependencies:
- prettier
6 changes: 3 additions & 3 deletions validate-projects.js
Expand Up @@ -9,7 +9,7 @@ assert.isArray(projects, "projects.yml must parse as an array");

projects.forEach(projectInfo => {
assert.typeOf(projectInfo.name, "string", "Project names must be strings");
assert.match(projectInfo.name, /^[\w-]+$/, `Project name must only contain alphanumeric characters and dashes. ('${projectInfo.name}' contains special characters.)`);
assert.match(projectInfo.name, /^[\w-]+$/u, `Project name must only contain alphanumeric characters and dashes. ('${projectInfo.name}' contains special characters.)`);
assert.typeOf(projectInfo.repo, "string");
assert.isArray(projectInfo.args, `Expected the arguments for ${projectInfo.name} to be an array`);

Expand All @@ -20,7 +20,7 @@ projects.forEach(projectInfo => {
assert.isArray(projectInfo.dependencies, "Project dependencies must be in an array");
}

assert.match(projectInfo.commit, /^[0-9a-f]{40}$/, "Project commit must be a full commit hash");
assert.match(projectInfo.commit, /^[0-9a-f]{40}$/u, "Project commit must be a full commit hash");
});

assert.deepEqual(projects.map(project => project.name), projects.map(project => project.name).sort(), "Project names should be sorted");
assert.deepStrictEqual(projects.map(project => project.name), projects.map(project => project.name).sort(), "Project names should be sorted");