eslint-plugin-pagecall-test
Advanced tools
Comparing version 1.0.7 to 1.0.8
"use strict"; | ||
const tslib_1 = require("tslib"); | ||
const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); | ||
const path_1 = (0, tslib_1.__importDefault)(require("path")); | ||
function parseFilename(filename) { | ||
var ext = path_1.default.extname(filename); | ||
return { | ||
dir: path_1.default.dirname(filename), | ||
base: path_1.default.basename(filename), | ||
ext: ext, | ||
name: path_1.default.basename(filename, ext), | ||
}; | ||
} | ||
const rule = experimental_utils_1.ESLintUtils.RuleCreator(str => 'temp')({ | ||
@@ -28,8 +17,4 @@ defaultOptions: [], | ||
create: context => { | ||
const root = context.options[1]; | ||
const filename = context.getFilename(); | ||
const absoluteFilename = path_1.default.resolve(filename); | ||
const parsed = parseFilename(absoluteFilename); | ||
const [, relativePath] = parsed.dir.split(root); | ||
if (relativePath === null || relativePath === void 0 ? void 0 : relativePath.includes(`states\/stores`)) | ||
if (!filename.includes('states/stores')) | ||
return {}; | ||
@@ -36,0 +21,0 @@ return { |
{ | ||
"name": "eslint-plugin-pagecall-test", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"main": "./dist/index.js", | ||
@@ -10,3 +10,4 @@ "dependencies": { | ||
"scripts": { | ||
"build": "tsc -p tsconfig.json" | ||
"build": "tsc -p tsconfig.json", | ||
"dev": "yarn build -w" | ||
}, | ||
@@ -13,0 +14,0 @@ "devDependencies": { |
import { ESLintUtils } from '@typescript-eslint/experimental-utils'; | ||
import path from 'path'; | ||
function parseFilename(filename: string) { | ||
var ext = path.extname(filename); | ||
return { | ||
dir: path.dirname(filename), | ||
base: path.basename(filename), | ||
ext: ext, | ||
name: path.basename(filename, ext), | ||
}; | ||
} | ||
const rule = ESLintUtils.RuleCreator(str => 'temp')({ | ||
@@ -29,8 +17,4 @@ defaultOptions: [], | ||
create: context => { | ||
const root = context.options[1]; | ||
const filename = context.getFilename(); | ||
const absoluteFilename = path.resolve(filename); | ||
const parsed = parseFilename(absoluteFilename); | ||
const [, relativePath] = parsed.dir.split(root); | ||
if (relativePath?.includes(`states\/stores`)) return {}; | ||
if (!filename.includes('states/stores')) return {}; | ||
return { | ||
@@ -37,0 +21,0 @@ Identifier: node => { |
18756
88