Skip to content

Commit

Permalink
Remvoing unnecessary moduleId
Browse files Browse the repository at this point in the history
  • Loading branch information
scalvert committed Feb 17, 2021
1 parent 9a89cb5 commit 9455eff
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions lib/rules/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const Scope = require('./internal/scope');
// Constant to return from AST handlers so we know to remove/unregister them
const REMOVE_HANDLER = {};

const MODULE_ID = Symbol('_moduleId');
const MODULE_NAME = Symbol('_moduleName');

const loggedModules = new Set([]);
Expand Down Expand Up @@ -63,7 +62,6 @@ module.exports = class Base {
this._configStack = [this.config];

this._filePath = options.filePath;
this[MODULE_ID] = options.moduleId;
this[MODULE_NAME] = options.moduleName;
this._rawSource = options.rawSource;

Expand All @@ -75,27 +73,13 @@ module.exports = class Base {
return this._configResolver.editorConfig();
}

get _moduleId() {
const moduleIdKey = `${this.constructor.name}:moduleId`;

if (!loggedModules.has(moduleIdKey)) {
this._console.log('The `_moduleId` property is deprecated. Please use `_filePath` instead.');

this.loggedModules.push(moduleIdKey);
}

return this[MODULE_ID];
}

get _moduleName() {
const moduleNameKey = `${this.constructor.name}:moduleName`;

if (!loggedModules.has(moduleNameKey)) {
if (!loggedModules.has(this.ruleName)) {
this._console.log(
'The `_moduleName` property is deprecated. Please use `_filePath` instead.'
);

this.loggedModules.push(moduleNameKey);
this.loggedModules.push(this.ruleName);
}

return this[MODULE_NAME];
Expand Down

0 comments on commit 9455eff

Please sign in to comment.