Skip to content

Commit

Permalink
dependencies removed and mocha version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
rchougule committed Sep 7, 2019
1 parent 0f61561 commit 05bf4c8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
10 changes: 7 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
* @fileoverview Prevention of explicit mention of extensions while requiring files
* @author Rohan Chougule
*/
"use strict";
'use strict';

var requireIndex = require("requireindex");
const allRules = {
'no-js-ext': require('./rules/no-js-ext')
}

module.exports.rules = requireIndex(__dirname + "/rules");
module.exports = {
rules: allRules
}



17 changes: 9 additions & 8 deletions lib/rules/no-js-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @fileoverview Prevent mention of extension while requiring JS files
* @author Rohan Chougule
*/
"use strict";
'use strict';

module.exports = {
meta: {
Expand All @@ -14,16 +14,17 @@ module.exports = {
schema: []
},

create: function(context) {
create: (context) => {
return {
CallExpression: (node) => {
if (node.callee &&
node.callee.name === 'require' &&
/\.js$/.test(node.arguments[0].value)) {

if (
node.callee
&& node.callee.name === 'require'
&& /\.js$/.test(node.arguments[0].value)
) {
context.report(node, `'require('${node.arguments[0].value}')' shouldn't need .js extension`);
}
}
}
}
};
}
};
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-avoid-explicit-extension",
"version": "1.0.3",
"version": "1.0.4",
"repository": {
"type": "git",
"url": "https://github.com/rchougule/eslint-plugin-avoid-explicit-extension.git"
Expand All @@ -16,12 +16,9 @@
"scripts": {
"test": "mocha tests --recursive"
},
"dependencies": {
"requireindex": "~1.1.0"
},
"devDependencies": {
"eslint": ">=4.18.2",
"mocha": "^3.1.2"
"mocha": ">=6.2.0"
},
"engines": {
"node": ">=0.10.0"
Expand Down

0 comments on commit 05bf4c8

Please sign in to comment.