Skip to content

Commit b1a63d3

Browse files
committed
chore: cleanup filename
1 parent 05b5a4a commit b1a63d3

12 files changed

+17
-20
lines changed

lib/rules/match-component-file-name.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ module.exports = {
6464
? extensionsArray
6565
: ['jsx']
6666

67-
const extension = path.extname(context.getFilename())
68-
const filename = path.basename(context.getFilename(), extension)
67+
const extension = path.extname(context.filename)
68+
const filename = path.basename(context.filename, extension)
6969

7070
/** @type {Rule.ReportDescriptor[]} */
7171
const errors = []

lib/rules/multi-word-component-names.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module.exports = {
114114
'Program:exit'(node) {
115115
if (hasName) return
116116
if (!hasVue && node.body.length > 0) return
117-
const fileName = context.getFilename()
117+
const fileName = context.filename
118118
const componentName = path.basename(fileName, path.extname(fileName))
119119
if (
120120
utils.isVueFile(fileName) &&

lib/rules/no-multi-spaces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = {
5454
Program(node) {
5555
const sourceCode = context.sourceCode
5656
if (sourceCode.parserServices.getTemplateBodyTokenStore == null) {
57-
const filename = context.getFilename()
57+
const filename = context.filename
5858
if (path.extname(filename) === '.vue') {
5959
context.report({
6060
loc: { line: 1, column: 0 },

lib/rules/no-restricted-call-after-await.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ module.exports = {
9696
function getAllLocalImports(ast) {
9797
if (!allLocalImports) {
9898
allLocalImports = {}
99-
const dir = path.dirname(context.getFilename())
99+
const dir = path.dirname(context.filename)
100100
for (const body of ast.body) {
101101
if (body.type !== 'ImportDeclaration') {
102102
continue

lib/rules/no-undef-components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ module.exports = {
247247
}
248248

249249
// For circular references
250-
const fileName = context.getFilename()
250+
const fileName = context.filename
251251
const selfComponentName = path.basename(fileName, path.extname(fileName))
252252
definedInSetupComponents.addName(selfComponentName)
253253
scriptVisitor = utils.defineVueVisitor(context, {

lib/rules/prefer-import-from-vue.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ module.exports = {
8383
return {
8484
ImportDeclaration(node) {
8585
// Skip imports without specifiers in `.d.ts` files
86-
if (
87-
node.specifiers.length === 0 &&
88-
context.getFilename().endsWith('.d.ts')
89-
)
86+
if (node.specifiers.length === 0 && context.filename.endsWith('.d.ts'))
9087
return
9188

9289
verifySource(node.source, () => {

lib/rules/require-direct-export.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = {
3131
},
3232
/** @param {RuleContext} context */
3333
create(context) {
34-
const filePath = context.getFilename()
34+
const filePath = context.filename
3535
if (!utils.isVueFile(filePath)) return {}
3636

3737
const disallowFunctional = (context.options[0] || {})

lib/rules/require-name-property.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ module.exports = {
7979
{
8080
messageId: 'addName',
8181
fix(fixer) {
82-
const extension = path.extname(context.getFilename())
83-
const filename = path.basename(context.getFilename(), extension)
82+
const extension = path.extname(context.filename)
83+
const filename = path.basename(context.filename, extension)
8484
const sourceCode = context.sourceCode
8585
// fix only when property is not empty
8686
if (component.properties.length > 0) {

lib/rules/require-typed-object-prop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module.exports = {
128128
},
129129
/** @param {RuleContext} context */
130130
create(context) {
131-
const filename = context.getFilename()
131+
const filename = context.filename
132132
if (!utils.isVueFile(filename) && !utils.isTypeScriptFile(filename)) {
133133
return {}
134134
}

lib/rules/require-typed-ref.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
},
4040
/** @param {RuleContext} context */
4141
create(context) {
42-
const filename = context.getFilename()
42+
const filename = context.filename
4343
if (!utils.isVueFile(filename) && !utils.isTypeScriptFile(filename)) {
4444
return {}
4545
}

0 commit comments

Comments
 (0)