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 2 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"
}
}
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");