Skip to content

Commit

Permalink
Fix: add missing dependencies (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Sep 1, 2020
1 parent 10965bc commit ff41a2f
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 1,914 deletions.
18 changes: 17 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ module.exports = {
ecmaVersion: 2020
},

/*
* it fixes eslint-plugin-jsdoc's reports: "Invalid JSDoc tag name "template" jsdoc/check-tag-names"
* refs: https://github.com/gajus/eslint-plugin-jsdoc#check-tag-names
*/
settings: {
jsdoc: {
mode: "typescript"
}
},

// TODO: remove when linting problems gets fixed
ignorePatterns: ["/tests/", "/conf/eslint-all.js"],
rules: {
"class-methods-use-this": "off"
},

overrides: [
{
files: ["tests/**/*"],
Expand All @@ -19,7 +35,7 @@ module.exports = {
message: "`assert.doesNotThrow()` should be replaced with a comment next to the code."
}]
}
},
}

]
};
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock = false
2 changes: 1 addition & 1 deletion conf/environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = new Map(Object.entries({
ecmaVersion: 12
}
},

// Platforms
browser: {
globals: globals.browser
Expand Down
1 change: 1 addition & 0 deletions conf/eslint-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// Requirements
//------------------------------------------------------------------------------

// FIXME: "../lib/rules" doesn't exist in this package
const builtInRules = require("../lib/rules");

//------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions lib/cascading-config-array-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ class CascadingConfigArrayFactory {
const validator = new ConfigValidator({
builtInRules: configArrayFactory.builtInRules
});

validator.validateConfigArray(finalConfigArray);

// Cache it.
Expand Down
1 change: 1 addition & 0 deletions lib/config-array-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ class ConfigArrayFactory {
*/
_normalizeConfigData(configData, ctx) {
const validator = new ConfigValidator();

validator.validateConfigSchema(configData, ctx.name || ctx.filePath);
return this._normalizeObjectConfigData(configData, ctx);
}
Expand Down
3 changes: 1 addition & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ const naming = require("./shared/naming");
module.exports = {

Legacy: {
// config-array
ConfigArray,
createConfigArrayFactoryContext,
CascadingConfigArrayFactory,
ConfigArray,
ConfigArrayFactory,
ConfigDependency,
ExtractedConfig,
IgnorePattern,
Expand Down
9 changes: 4 additions & 5 deletions lib/shared/config-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const
util = require("util"),
configSchema = require("../../conf/config-schema"),
BuiltInEnvironments = require("../../conf/environments"),
// BuiltInRules = require("../rules"),
ConfigOps = require("./config-ops"),
{ emitDeprecationWarning } = require("./deprecation-warnings");

Expand All @@ -38,7 +37,7 @@ const validated = new WeakSet();
//-----------------------------------------------------------------------------

module.exports = class ConfigValidator {
constructor({builtInRules = new Map()} = {}) {
constructor({ builtInRules = new Map() } = {}) {
this.builtInRules = builtInRules;
}

Expand Down Expand Up @@ -266,10 +265,10 @@ module.exports = class ConfigValidator {
* @returns {void}
*/
validateConfigSchema(config, source = null) {
const validateSchema = this.validateSchema || ajv.compile(configSchema);
validateSchema = this.validateSchema || ajv.compile(configSchema);

if (!validateSchema(config)) {
throw new Error(`ESLint configuration in ${source} is invalid:\n${formatErrors(validateSchema.errors)}`);
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
}

if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
Expand Down Expand Up @@ -322,4 +321,4 @@ module.exports = class ConfigValidator {
}
}

}
};
Loading

0 comments on commit ff41a2f

Please sign in to comment.