From 17949c2832c1834462fe3fb2f9d37d71d7e13282 Mon Sep 17 00:00:00 2001 From: Tony Atkins Date: Tue, 12 Jan 2021 15:41:02 +0100 Subject: [PATCH 1/5] GH-31: Migrate to `fluid-lint-all` and update all dependencies. --- .fluidlintallrc.json | 18 ++++++++++++++++++ .github/workflows/main.yml | 2 +- Gruntfile.js | 18 ------------------ package.json | 17 +++++++---------- src/js/common/fss-metaschema.js | 1 + src/js/common/orderedStringify.js | 1 + src/js/common/schemaValidatedComponent.js | 1 + src/js/common/schemaValidatedModelComponent.js | 1 + src/js/common/validator.js | 1 + tests/browser-fixtures/js/errorBinder-tests.js | 2 ++ tests/js/common/lib/check-potentia-grades.js | 1 + tests/js/common/metaschema-tests.js | 4 +++- tests/js/common/orderedStringify-tests.js | 4 +++- tests/js/common/schema-holder-tests.js | 4 +++- ...alidated-component-pre-potentia-ii-tests.js | 2 ++ .../common/schema-validated-component-tests.js | 1 + .../schema-validated-modelComponent-tests.js | 4 +++- .../common/validator-global-component-tests.js | 4 +++- .../validator-static-function-testDefs.js | 4 +++- .../validator-tests-ajv-errors-testDefs.js | 1 + tests/templates/layouts/main.handlebars | 2 -- 21 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 .fluidlintallrc.json delete mode 100644 Gruntfile.js diff --git a/.fluidlintallrc.json b/.fluidlintallrc.json new file mode 100644 index 0000000..89d3a5e --- /dev/null +++ b/.fluidlintallrc.json @@ -0,0 +1,18 @@ +{ + "sources": { + "md": [ "./*.md","./docs/*.md"], + "js": ["./src/**/*.js", "./tests/**/*.js", "./*.js"], + "json": ["./src/**/*.json", "./tests/**/*.json", "./*.json"], + "json5": ["./src/**/*.json5", "./tests/**/*.json5", "./*.json5"], + "other": ["./.*"] + }, + "eslint": { + "md": { + "options": { + "rules": { + "no-redeclare": false + } + } + } + } +} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34d12c4..fff2a33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: run: npm install - name: Lint Code - run: $(npm bin)/grunt lint + run: npm run lint - name: Node Tests run: xvfb-run --auto-servernum npm test diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 462c002..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-env node */ -"use strict"; -module.exports = function (grunt) { - grunt.initConfig({ - lintAll: { - sources: { - md: [ "./*.md","./docs/*.md"], - js: ["./src/**/*.js", "./tests/**/*.js", "./*.js"], - json: ["./src/**/*.json", "./tests/**/*.json", "./*.json"], - json5: ["./src/**/*.json5", "./tests/**/*.json5", "./*.json5"], - other: ["./.*"] - } - } - }); - - grunt.loadNpmTasks("fluid-grunt-lint-all"); - grunt.registerTask("lint", "Perform all standard lint checks.", ["lint-all"]); -}; diff --git a/package.json b/package.json index 79964b0..8878510 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,12 @@ "description": "Support validation of JSON within the Fluid ecosystem.", "main": "index.js", "scripts": { - "pretest": "node node_modules/rimraf/bin.js coverage reports && node node_modules/mkdirp coverage reports", + "lint": "fluid-lint-all", + "pretest": "npx rimraf coverage reports && npx mkdirp coverage reports", "test": "npm run test:node && npm run test:browser", - "test:node": "node node_modules/nyc/bin/nyc.js --reporter none node tests/all-node-tests.js", - "test:browser": "node node_modules/testem/testem.js ci --file tests/testem.js", - "posttest": "node node_modules/nyc/bin/nyc.js report" + "test:node": "nyc --reporter none node tests/all-node-tests.js", + "test:browser": "testem ci --file tests/testem.js", + "posttest": "nyc report" }, "repository": { "type": "git", @@ -21,24 +22,20 @@ "fluid-binder": "1.1.1", "fluid-express": "1.0.16", "fluid-handlebars": "2.1.3", - "infusion": "3.0.0-dev.20200525T143422Z.f7f6aab.FLUID-6148", + "infusion": "3.0.0-dev.20201113T153152Z.32176dcbe.FLUID-6145", "kettle": "1.15.0" }, "devDependencies": { "eslint": "7.4.0", "eslint-config-fluid": "1.4.0", - "eslint-plugin-markdown": "1.0.2", "foundation-sites": "6.6.3", - "fluid-grunt-lint-all": "1.0.8", + "fluid-lint-all": "1.0.0-dev.20210111T144240Z.ee70ce3.GH-1", "fluid-testem": "2.1.13", - "grunt": "1.2.1", "handlebars": "4.7.6", "markdown-it": "11.0.0", - "mkdirp": "1.0.4", "node-jqunit": "1.1.8", "nyc": "15.1.0", "request": "2.88.2", - "rimraf": "3.0.2", "testem": "3.2.0" } } diff --git a/src/js/common/fss-metaschema.js b/src/js/common/fss-metaschema.js index bf0d592..85e0d18 100644 --- a/src/js/common/fss-metaschema.js +++ b/src/js/common/fss-metaschema.js @@ -1,5 +1,6 @@ /* eslint-env browser */ /* globals require */ +/* eslint-disable-next-line no-redeclare */ var fluid = fluid || require("infusion"); (function (fluid) { "use strict"; diff --git a/src/js/common/orderedStringify.js b/src/js/common/orderedStringify.js index 339719e..86b9de9 100644 --- a/src/js/common/orderedStringify.js +++ b/src/js/common/orderedStringify.js @@ -1,4 +1,5 @@ /* globals require */ +/* eslint-disable-next-line no-redeclare */ var fluid = fluid || require("infusion"); (function (fluid) { // TODO: pull this up into Infusion if we need to use this type of object hashing more broadly. diff --git a/src/js/common/schemaValidatedComponent.js b/src/js/common/schemaValidatedComponent.js index 1fc28f9..8ede50c 100644 --- a/src/js/common/schemaValidatedComponent.js +++ b/src/js/common/schemaValidatedComponent.js @@ -1,4 +1,5 @@ /* globals require */ +/* eslint-disable-next-line no-redeclare */ var fluid = fluid || require("infusion"); (function (fluid) { "use strict"; diff --git a/src/js/common/schemaValidatedModelComponent.js b/src/js/common/schemaValidatedModelComponent.js index 162b106..62350bd 100644 --- a/src/js/common/schemaValidatedModelComponent.js +++ b/src/js/common/schemaValidatedModelComponent.js @@ -1,4 +1,5 @@ /* globals require */ +/* eslint-disable-next-line no-redeclare */ var fluid = fluid || require("infusion"); (function (fluid) { "use strict"; diff --git a/src/js/common/validator.js b/src/js/common/validator.js index 335b011..557f0e9 100644 --- a/src/js/common/validator.js +++ b/src/js/common/validator.js @@ -1,5 +1,6 @@ /* eslint-env browser */ /* globals require, Ajv */ +/* eslint-disable-next-line no-redeclare */ var fluid = fluid || require("infusion"); (function (fluid, Ajv) { "use strict"; diff --git a/tests/browser-fixtures/js/errorBinder-tests.js b/tests/browser-fixtures/js/errorBinder-tests.js index c7c7578..de7a765 100644 --- a/tests/browser-fixtures/js/errorBinder-tests.js +++ b/tests/browser-fixtures/js/errorBinder-tests.js @@ -1,5 +1,7 @@ +/* eslint-disable no-redeclare */ /* global fluid, jQuery, jqUnit */ var fluid = fluid || {}; +/* eslint-enable no-redeclare */ (function (fluid, $, jqUnit) { "use strict"; fluid.setLogging(true); diff --git a/tests/js/common/lib/check-potentia-grades.js b/tests/js/common/lib/check-potentia-grades.js index 317717c..e5b24c1 100644 --- a/tests/js/common/lib/check-potentia-grades.js +++ b/tests/js/common/lib/check-potentia-grades.js @@ -1,5 +1,6 @@ /* globals require */ /* eslint-env browser */ +/* eslint-disable-next-line no-redeclare */ var fluid = fluid || {}; (function (fluid) { diff --git a/tests/js/common/metaschema-tests.js b/tests/js/common/metaschema-tests.js index 179b8b7..e1a415b 100644 --- a/tests/js/common/metaschema-tests.js +++ b/tests/js/common/metaschema-tests.js @@ -4,11 +4,13 @@ to validate FSS schemas. */ -/* globals Ajv, jqUnit, require */ /* eslint-env browser */ +/* eslint-disable no-redeclare */ +/* globals Ajv, jqUnit, require */ var fluid = fluid || {}; var Ajv = Ajv || {}; var jqUnit = jqUnit || {}; +/* eslint-enable no-redeclare */ (function (fluid, Ajv, jqUnit) { "use strict"; diff --git a/tests/js/common/orderedStringify-tests.js b/tests/js/common/orderedStringify-tests.js index 3a1082a..dba1e12 100644 --- a/tests/js/common/orderedStringify-tests.js +++ b/tests/js/common/orderedStringify-tests.js @@ -1,7 +1,9 @@ -/* globals jqUnit, require */ /* eslint-env browser */ +/* eslint-disable no-redeclare */ +/* globals jqUnit, require */ var fluid = fluid || {}; var jqUnit = jqUnit || {}; +/* eslint-enable no-redeclare */ (function (fluid, jqUnit) { "use strict"; diff --git a/tests/js/common/schema-holder-tests.js b/tests/js/common/schema-holder-tests.js index 7296d2d..cf2a260 100644 --- a/tests/js/common/schema-holder-tests.js +++ b/tests/js/common/schema-holder-tests.js @@ -1,7 +1,9 @@ /* eslint-env browser */ +/* eslint-disable no-redeclare */ /* globals require */ -var fluid = fluid || {}; +var fluid = fluid || {}; var jqUnit = jqUnit || {}; +/* eslint-enable no-redeclare */ (function (fluid, jqUnit) { "use strict"; diff --git a/tests/js/common/schema-validated-component-pre-potentia-ii-tests.js b/tests/js/common/schema-validated-component-pre-potentia-ii-tests.js index 16ace0a..0c25efd 100644 --- a/tests/js/common/schema-validated-component-pre-potentia-ii-tests.js +++ b/tests/js/common/schema-validated-component-pre-potentia-ii-tests.js @@ -5,10 +5,12 @@ */ /* eslint-env browser */ +/* eslint-disable no-redeclare */ /* globals require */ var fluid = fluid || {}; var Ajv = Ajv || {}; var jqUnit = jqUnit || {}; +/* eslint-enable no-redeclare */ (function (fluid, Ajv, jqUnit) { "use strict"; diff --git a/tests/js/common/schema-validated-component-tests.js b/tests/js/common/schema-validated-component-tests.js index fda9d1e..ccc4591 100644 --- a/tests/js/common/schema-validated-component-tests.js +++ b/tests/js/common/schema-validated-component-tests.js @@ -1,5 +1,6 @@ /* eslint-env browser */ /* globals require */ +/* eslint-disable-next-line no-redeclare */ var fluid = fluid || {}; var Ajv = Ajv || {}; var jqUnit = jqUnit || {}; diff --git a/tests/js/common/schema-validated-modelComponent-tests.js b/tests/js/common/schema-validated-modelComponent-tests.js index 06bbc8b..a6d8e32 100644 --- a/tests/js/common/schema-validated-modelComponent-tests.js +++ b/tests/js/common/schema-validated-modelComponent-tests.js @@ -1,8 +1,10 @@ -/* globals Ajv, jqUnit, require */ /* eslint-env browser */ +/* eslint-disable no-redeclare */ +/* globals Ajv, jqUnit, require */ var fluid = fluid || {}; var Ajv = Ajv || {}; var jqUnit = jqUnit || {}; +/* eslint-enable no-redeclare */ (function (fluid, Ajv, jqUnit) { "use strict"; diff --git a/tests/js/common/validator-global-component-tests.js b/tests/js/common/validator-global-component-tests.js index 5385920..70d8462 100644 --- a/tests/js/common/validator-global-component-tests.js +++ b/tests/js/common/validator-global-component-tests.js @@ -1,7 +1,9 @@ -/* globals jqUnit, require */ /* eslint-env browser */ +/* eslint-disable no-redeclare */ +/* globals jqUnit, require */ var fluid = fluid || {}; var jqUnit = jqUnit || {}; +/* eslint-enable no-redeclare */ (function (fluid, jqUnit) { "use strict"; diff --git a/tests/js/common/validator-static-function-testDefs.js b/tests/js/common/validator-static-function-testDefs.js index c4d293b..ad60e46 100644 --- a/tests/js/common/validator-static-function-testDefs.js +++ b/tests/js/common/validator-static-function-testDefs.js @@ -1,7 +1,9 @@ -/* globals jqUnit, require */ /* eslint-env browser */ +/* eslint-disable no-redeclare */ +/* globals jqUnit, require */ var fluid = fluid || {}; var jqUnit = jqUnit || {}; +/* eslint-enable no-redeclare */ (function (fluid, jqUnit) { "use strict"; diff --git a/tests/js/common/validator-tests-ajv-errors-testDefs.js b/tests/js/common/validator-tests-ajv-errors-testDefs.js index e43bfc2..0ff9228 100644 --- a/tests/js/common/validator-tests-ajv-errors-testDefs.js +++ b/tests/js/common/validator-tests-ajv-errors-testDefs.js @@ -1,5 +1,6 @@ /* globals require */ /* eslint-env browser */ +/* eslint-disable-next-line no-redeclare */ var fluid = fluid || {}; (function (fluid) { diff --git a/tests/templates/layouts/main.handlebars b/tests/templates/layouts/main.handlebars index 97516a9..d69979e 100644 --- a/tests/templates/layouts/main.handlebars +++ b/tests/templates/layouts/main.handlebars @@ -12,5 +12,3 @@ {{{body}}} - - From 4848f15b81d386a04b6c0ed0d4d8bbadbc7d0753 Mon Sep 17 00:00:00 2001 From: Tony Atkins Date: Fri, 15 Jan 2021 10:31:28 +0100 Subject: [PATCH 2/5] GH-31: Updated to newer Infusion hoping to fix error binder issues. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8878510..1216c22 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "ajv": "6.12.3", "fluid-binder": "1.1.1", "fluid-express": "1.0.16", - "fluid-handlebars": "2.1.3", - "infusion": "3.0.0-dev.20201113T153152Z.32176dcbe.FLUID-6145", + "fluid-handlebars": "2.1.4-dev.20210115T091020Z.6bdf9d3.GH-37", + "infusion": "3.0.0-dev.20210114T211758Z.d345ecd74.FLUID-6145", "kettle": "1.15.0" }, "devDependencies": { From 7356bca84a9395c447bb61b7929ff76e694f4920 Mon Sep 17 00:00:00 2001 From: Tony Atkins Date: Fri, 15 Jan 2021 10:33:34 +0100 Subject: [PATCH 3/5] GH-31: Updated to newer Infusion hoping to fix error binder issues. --- .fluidlintallrc.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.fluidlintallrc.json b/.fluidlintallrc.json index 89d3a5e..84125b8 100644 --- a/.fluidlintallrc.json +++ b/.fluidlintallrc.json @@ -9,8 +9,10 @@ "eslint": { "md": { "options": { - "rules": { - "no-redeclare": false + "overrideConfig": { + "rules": { + "no-redeclare": 0 + } } } } From 89345e908f17fa86199d64ebcbce4d7b111c05db Mon Sep 17 00:00:00 2001 From: Tony Atkins Date: Fri, 15 Jan 2021 13:39:00 +0100 Subject: [PATCH 4/5] GH-31: Updated to FLUID-6580 variant of Infusion to resolve error binder issues. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1216c22..464c450 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "fluid-binder": "1.1.1", "fluid-express": "1.0.16", "fluid-handlebars": "2.1.4-dev.20210115T091020Z.6bdf9d3.GH-37", - "infusion": "3.0.0-dev.20210114T211758Z.d345ecd74.FLUID-6145", + "infusion": "3.0.0-dev.20210114T215306Z.2b1fe9609.FLUID-6580", "kettle": "1.15.0" }, "devDependencies": { From 1e830dd0e8f50226a39c2dc06b6f542f15caa06a Mon Sep 17 00:00:00 2001 From: Tony Atkins Date: Tue, 19 Jan 2021 11:06:00 +0100 Subject: [PATCH 5/5] GH-31: Updated to released versions of upstream fluid-x dependencies. Fixed minor JSDoc linting issue. --- package.json | 14 +++++++------- src/js/common/validator.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 464c450..8622d2d 100644 --- a/package.json +++ b/package.json @@ -19,18 +19,18 @@ "license": "BSD-3-Clause", "dependencies": { "ajv": "6.12.3", - "fluid-binder": "1.1.1", - "fluid-express": "1.0.16", - "fluid-handlebars": "2.1.4-dev.20210115T091020Z.6bdf9d3.GH-37", + "fluid-binder": "1.1.2", + "fluid-express": "1.0.17", + "fluid-handlebars": "2.1.4", "infusion": "3.0.0-dev.20210114T215306Z.2b1fe9609.FLUID-6580", "kettle": "1.15.0" }, "devDependencies": { - "eslint": "7.4.0", - "eslint-config-fluid": "1.4.0", + "eslint": "7.18.0", + "eslint-config-fluid": "2.0.0", "foundation-sites": "6.6.3", - "fluid-lint-all": "1.0.0-dev.20210111T144240Z.ee70ce3.GH-1", - "fluid-testem": "2.1.13", + "fluid-lint-all": "1.0.0", + "fluid-testem": "2.1.14", "handlebars": "4.7.6", "markdown-it": "11.0.0", "node-jqunit": "1.1.8", diff --git a/src/js/common/validator.js b/src/js/common/validator.js index 557f0e9..cf0b385 100644 --- a/src/js/common/validator.js +++ b/src/js/common/validator.js @@ -254,7 +254,7 @@ var fluid = fluid || require("infusion"); * @typedef schemaValidationResult * @property {Boolean} isError - `true` if there is a validation, `false` (or missing) otherwise. * @property {String} message - A summary of the result. - * @property {Array} - An array of validation errors returned by AJV when validating the schema. + * @property {Array} errors - An array of validation errors returned by AJV when validating the schema. * */