@opencreek/eslint-plugin-ts
Advanced tools
Comparing version 0.5.0-canary.20.5942096243.0 to 0.5.0-canary.20.5942334688.0
@@ -11,2 +11,8 @@ "use strict"; | ||
const creator = RuleCreator((rule) => rule); | ||
const possibleExtensions = [".js", ".jsx", ".ts", ".tsx"]; | ||
function pathExistsWithAnyExtension(file, context) { | ||
return possibleExtensions.some((it) => { | ||
return fs_1.default.existsSync(path_1.default.resolve(path_1.default.dirname(context.getFilename()), file + it)); | ||
}); | ||
} | ||
exports.default = creator({ | ||
@@ -22,3 +28,3 @@ name: "require-import-js-extension", | ||
messages: { | ||
"require-import-js-extension": "No relative imports", | ||
"require-import-js-extension": "Require .js extension", | ||
}, | ||
@@ -32,7 +38,7 @@ schema: [], | ||
const source = node.source.value; | ||
if (source.indexOf(".") === -1) { | ||
if (source.indexOf(".") !== -1) { | ||
return; | ||
} | ||
const directFileExist = fs_1.default.existsSync(path_1.default.resolve(path_1.default.dirname(context.getFilename()), source + ".js")); | ||
const indexFileExist = fs_1.default.existsSync(path_1.default.resolve(path_1.default.dirname(context.getFilename()), source + "/index.js")); | ||
const directFileExist = pathExistsWithAnyExtension(source, context); | ||
const indexFileExist = pathExistsWithAnyExtension(source + "/index", context); | ||
context.report({ | ||
@@ -39,0 +45,0 @@ node, |
{ | ||
"name": "@opencreek/eslint-plugin-ts", | ||
"version": "0.5.0-canary.20.5942096243.0", | ||
"version": "0.5.0-canary.20.5942334688.0", | ||
"description": "ESLint plugin for Common TypeScript rules", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "9112394a9bb2d2a901af19758355bdf703be9a8a" | ||
"gitHead": "0870abf745ae8284e7af0365a2e8232accb76d20" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
66885
351
0