diff --git a/.eslintrc.yml b/.eslintrc.yml index d5208b3..fc5f5e2 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -9,3 +9,5 @@ rules: - error - name: child_process message: Please use cross-spawn instead. + + no-console: off diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..c1ca392 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock = false diff --git a/.travis.yml b/.travis.yml index 61103f7..2bc4f39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: node_js node_js: - - 6 - - 7 + - 10 + - 12 diff --git a/canary.js b/canary.js index 51d07be..3a06c88 100644 --- a/canary.js +++ b/canary.js @@ -41,11 +41,11 @@ 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); @@ -53,11 +53,11 @@ function spawn(command, args) { } /** -* 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; @@ -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}`); @@ -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 { diff --git a/package.json b/package.json index 601c0a3..021a278 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/projects.yml b/projects.yml index 3d4efa4..e58a04c 100644 --- a/projects.yml +++ b/projects.yml @@ -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 @@ -25,60 +24,46 @@ - name: mocha repo: https://github.com/mochajs/mocha - commit: 09ce746aa925d35317f2624fd36c77a31bb68e24 + commit: 883ae4b5e1aacd8cf30694da33b391ce58f4cca8 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 args: - - src - - test - - examples + - --ext js,ts + - src/**/* + - 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 diff --git a/validate-projects.js b/validate-projects.js index 2592917..ad14cc5 100644 --- a/validate-projects.js +++ b/validate-projects.js @@ -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`); @@ -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");