Skip to content

Commit

Permalink
chore(src): linting pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Dec 30, 2024
1 parent 45161d6 commit 63da958
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
12 changes: 7 additions & 5 deletions src/rules/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const properties = {
additionalProperties: false,
required: ['pattern', 'action'],
},
}
},
},
};

Expand Down Expand Up @@ -168,7 +168,7 @@ module.exports = {
return false;
}

function computeOverrideAction(pathGroupOverrides = [], path) {
function computeOverrideAction(pathGroupOverrides, path) {
for (let i = 0, l = pathGroupOverrides.length; i < l; i++) {
const { pattern, patternOptions, action } = pathGroupOverrides[i];
if (minimatch(path, pattern, patternOptions || { nocomment: true })) {
Expand All @@ -185,11 +185,13 @@ module.exports = {

// If not undefined, the user decided if rules are enforced on this import
const overrideAction = computeOverrideAction(
props.pathGroupOverrides,
importPathWithQueryString
props.pathGroupOverrides || [],
importPathWithQueryString,
);

if(overrideAction === 'ignore') { return ; }
if (overrideAction === 'ignore') {
return;
}

// don't enforce anything on builtins
if (!overrideAction && isBuiltIn(importPathWithQueryString, context.settings)) { return; }
Expand Down
40 changes: 20 additions & 20 deletions tests/src/rules/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,11 +756,11 @@ describe('TypeScript', () => {
pathGroupOverrides: [
{
pattern: 'multiverse{*,*/**}',
action: 'enforce'
}
]
}
]
action: 'enforce',
},
],
},
],
}),
// pathGroupOverrides: an enforce pattern matches good bespoke specifiers
test({
Expand All @@ -781,11 +781,11 @@ describe('TypeScript', () => {
pathGroupOverrides: [
{
pattern: 'rootverse{*,*/**}',
action: 'enforce'
action: 'enforce',
},
]
}
]
],
},
],
}),
// pathGroupOverrides: an ignore pattern matches bad bespoke specifiers
test({
Expand All @@ -806,15 +806,15 @@ describe('TypeScript', () => {
pathGroupOverrides: [
{
pattern: 'multiverse{*,*/**}',
action: 'enforce'
action: 'enforce',
},
{
pattern: 'rootverse{*,*/**}',
action: 'ignore'
action: 'ignore',
},
]
}
]
],
},
],
}),
],
invalid: [
Expand Down Expand Up @@ -856,14 +856,14 @@ describe('TypeScript', () => {
pathGroupOverrides: [
{
pattern: 'rootverse{*,*/**}',
action: 'enforce'
action: 'enforce',
},
{
pattern: 'universe{*,*/**}',
action: 'ignore'
}
]
}
action: 'ignore',
},
],
},
],
errors: [
{
Expand All @@ -873,7 +873,7 @@ describe('TypeScript', () => {
{
message: 'Missing file extension for "rootverse+bfe:src/symbols"',
line: 5,
}
},
],
}),
],
Expand Down

0 comments on commit 63da958

Please sign in to comment.