Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/.vuepress/categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = categoryIds.map((categoryId) => ({
categoryId,
title: categoryTitles[categoryId],
rules: (categoryRules[categoryId] || []).filter(
(rule) => !rule.meta.deprecated
(rule) => !rule.meta.deprecated,
),
}));
// .filter(category => category.rules.length >= 1)
4 changes: 2 additions & 2 deletions docs/.vuepress/components/components/EslintPluginEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ export default {
editor.$watch("codeEditor", () => {
if (editor.codeEditor) {
editor.codeEditor.onDidChangeModelDecorations(() =>
this.onDidChangeModelDecorations(editor.codeEditor)
this.onDidChangeModelDecorations(editor.codeEditor),
);
}
});
editor.$watch("fixedCodeEditor", () => {
if (editor.fixedCodeEditor) {
editor.fixedCodeEditor.onDidChangeModelDecorations(() =>
this.onDidChangeModelDecorations(editor.fixedCodeEditor)
this.onDidChangeModelDecorations(editor.fixedCodeEditor),
);
}
});
Expand Down
10 changes: 5 additions & 5 deletions docs/.vuepress/components/components/RulesSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
<input
:checked="
categories.every((category) =>
category.rules.every((rule) => isErrorState(rule.ruleId))
category.rules.every((rule) => isErrorState(rule.ruleId)),
)
"
type="checkbox"
:indeterminate.prop="
categories.some((category) =>
category.rules.some((rule) => isErrorState(rule.ruleId))
category.rules.some((rule) => isErrorState(rule.ruleId)),
) &&
categories.some((category) =>
category.rules.some((rule) => !isErrorState(rule.ruleId))
category.rules.some((rule) => !isErrorState(rule.ruleId)),
)
"
@input="onAllClick($event)"
Expand Down Expand Up @@ -139,7 +139,7 @@ export default {
close: true,
},
];
})
}),
),
filterValue: "",
};
Expand All @@ -159,7 +159,7 @@ export default {
let filteredRules = rules;
if (this.filterValue) {
filteredRules = filteredRules.filter((r) =>
r.ruleId.includes(this.filterValue)
r.ruleId.includes(this.filterValue),
);
}
return filteredRules;
Expand Down
4 changes: 2 additions & 2 deletions docs/.vuepress/components/rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ for (const k of Object.keys(coreRules)) {
}

allRules.sort((a, b) =>
a.ruleId > b.ruleId ? 1 : a.ruleId < b.ruleId ? -1 : 0
a.ruleId > b.ruleId ? 1 : a.ruleId < b.ruleId ? -1 : 0,
);

export const categories = [];
Expand Down Expand Up @@ -122,7 +122,7 @@ categories.sort((a, b) =>
? 1
: a.title < b.title
? -1
: 0
: 0,
);

export const DEFAULT_RULES_CONFIG = allRules.reduce((c, r) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/components/state/serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function serializeState(state) {
`The compress rate of serialized string: ${(
(100 * base64.length) /
jsonString.length
).toFixed(1)}% (${jsonString.length}B → ${base64.length}B)`
).toFixed(1)}% (${jsonString.length}B → ${base64.length}B)`,
);

return base64;
Expand Down
8 changes: 4 additions & 4 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ module.exports = {
alias: {
esquery: path.resolve(
__dirname,
"../../node_modules/esquery/dist/esquery.min.js"
"../../node_modules/esquery/dist/esquery.min.js",
),
"@eslint/eslintrc/universal": path.resolve(
__dirname,
"../../node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs"
"../../node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs",
),
eslint$: require.resolve("./shim/eslint"),
// eslint-disable-next-line node/no-extraneous-require -- demo
Expand All @@ -32,7 +32,7 @@ module.exports = {
module: require.resolve("./shim/module"),
postcss$: path.resolve(
__dirname,
"../../node_modules/postcss/lib/postcss.mjs"
"../../node_modules/postcss/lib/postcss.mjs",
),
},
},
Expand Down Expand Up @@ -80,7 +80,7 @@ module.exports = {
meta: {
docs: { ruleId, ruleName },
},
}) => [`/rules/${ruleName}`, ruleId]
}) => [`/rules/${ruleName}`, ruleId],
),
}))
.filter((menu) => Boolean(menu.children.length)),
Expand Down
11 changes: 7 additions & 4 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ const configs = {
all: require("./configs/all"),
};

const rules = ruleList.reduce((obj, r) => {
obj[r.meta.docs?.ruleName || ""] = r;
return obj;
}, {} as { [key: string]: Rule });
const rules = ruleList.reduce(
(obj, r) => {
obj[r.meta.docs?.ruleName || ""] = r;
return obj;
},
{} as { [key: string]: Rule },
);

export = {
configs,
Expand Down
2 changes: 1 addition & 1 deletion lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface ParsedQueryOptions {
* Parse options
*/
export function parseQueryOptions(
options: QueryOptions | undefined
options: QueryOptions | undefined,
): ParsedQueryOptions {
const { ignoreBEMModifier, captureClassesFromDoc } = options || {};

Expand Down
10 changes: 5 additions & 5 deletions lib/rules/enforce-style-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export = {
*/
function removeAttr(
fixer: RuleFixer,
node: AST.VAttribute | AST.VDirective
node: AST.VAttribute | AST.VDirective,
) {
const { attributes } = node.parent;
const prevToken = tokenStore.getTokenBefore(node);
Expand All @@ -99,7 +99,7 @@ export = {
*/
function reportForbiddenStyle(node: AST.VElement, attribute: StyleTypes) {
const forbiddenAttr = node.startTag.attributes.find(
(attr) => attr.key.name === attribute
(attr) => attr.key.name === attribute,
);
const forbiddenAttrName = forbiddenAttr!.key.name as string;

Expand Down Expand Up @@ -172,8 +172,8 @@ export = {
const forbiddenAttrs = node.startTag.attributes.filter(
(attr) =>
styleTypesAttrs.includes(
attr.key.name as (typeof styleTypesAttrs)[number]
) && !allows.includes(attr.key.name as StyleTypes)
attr.key.name as (typeof styleTypesAttrs)[number],
) && !allows.includes(attr.key.name as StyleTypes),
);

reporter.report({
Expand All @@ -200,7 +200,7 @@ export = {
},
fix(fixer: RuleFixer) {
return lodash.flatMap(forbiddenAttrs, (attr) =>
removeAttr(fixer, attr)
removeAttr(fixer, attr),
);
},
},
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-deprecated-v-enter-v-leave-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export = {
function report(
node: VCSSSelectorNode | AST.VIdentifier | AST.VDirectiveKey,
messageId: "deprecatedClass" | "deprecatedProps",
kind: Kind
kind: Kind,
) {
reporter.report({
node,
Expand Down Expand Up @@ -206,7 +206,7 @@ export = {
for (const transition of getElements(
context,
(element) =>
isTransitionElement(element) || isTransitionGroupElement(element)
isTransitionElement(element) || isTransitionGroupElement(element),
)) {
const { hasEnterClass, hasLeaveClass } =
verifyTransitionElementNode(transition);
Expand Down
10 changes: 5 additions & 5 deletions lib/rules/no-unused-selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ function getScopedSelectors(style: ValidStyleContext): VCSSSelectorNode[][] {
* @returns scoped selector
*/
function getScopedSelector(
resolvedSelector: ResolvedSelector
resolvedSelector: ResolvedSelector,
): VCSSSelectorNode[] | null {
const { selector } = resolvedSelector;
const specialNodeIndex = selector.findIndex(
(s) => isDeepCombinator(s) || isVueSpecialPseudo(s)
(s) => isDeepCombinator(s) || isVueSpecialPseudo(s),
);
let scopedCandidateSelector: VCSSSelectorNode[];
if (specialNodeIndex >= 0) {
Expand Down Expand Up @@ -169,7 +169,7 @@ export = {
*/
function verifySelector(
queryContext: QueryContext,
scopedSelector: VCSSSelectorNode[]
scopedSelector: VCSSSelectorNode[],
) {
const reportSelectorNodes: VCSSSelectorNode[] = [];
let targetsQueryContext = queryContext;
Expand Down Expand Up @@ -203,7 +203,7 @@ export = {
isTypeSelector(s) ||
isIDSelector(s) ||
isUniversalSelector(s) ||
isVueSpecialPseudo(s)
isVueSpecialPseudo(s),
);

for (const selectorNode of notClassSelectors) {
Expand Down Expand Up @@ -247,7 +247,7 @@ export = {
"Program:exit"() {
const queryContext = createQueryContext(
context,
parseQueryOptions(context.options[0])
parseQueryOptions(context.options[0]),
);

for (const style of styles) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/require-scoped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export = {
*/
function reportNever(node: AST.VElement) {
const scopedAttr = node.startTag.attributes.find(
(attr) => attr.key.name === "scoped"
(attr) => attr.key.name === "scoped",
);
reporter.report({
node: scopedAttr!,
Expand Down
10 changes: 5 additions & 5 deletions lib/rules/require-selector-used-inside.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ function getScopedSelectors(style: ValidStyleContext): VCSSSelectorNode[][] {
* @returns {VCSSSelectorNode[]} scoped selector
*/
function getScopedSelector(
resolvedSelector: ResolvedSelector
resolvedSelector: ResolvedSelector,
): VCSSSelectorNode[] | null {
const { selector } = resolvedSelector;
const specialNodeIndex = selector.findIndex(
(s) => isDeepCombinator(s) || isVueSpecialPseudo(s)
(s) => isDeepCombinator(s) || isVueSpecialPseudo(s),
);
if (specialNodeIndex >= 0) {
const specialNode = selector[specialNodeIndex];
Expand Down Expand Up @@ -148,7 +148,7 @@ export = {
*/
function verifySelector(
queryContext: QueryContext,
scopedSelector: VCSSSelectorNode[]
scopedSelector: VCSSSelectorNode[],
) {
let targetsQueryContext = queryContext;
const selectorNodes = scopedSelector
Expand All @@ -161,7 +161,7 @@ export = {
isIDSelector(s) ||
isClassSelector(s) ||
isUniversalSelector(s) ||
isVueSpecialPseudo(s)
isVueSpecialPseudo(s),
);

for (let index = 0; index < selectorNodes.length; index++) {
Expand All @@ -179,7 +179,7 @@ export = {
"Program:exit"() {
const queryContext = createQueryContext(
context,
parseQueryOptions(context.options[0])
parseQueryOptions(context.options[0]),
);

for (const style of styles) {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/require-v-deep-argument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export = {
* Find VCSSStyleRule or nest VCSSAtRule
*/
function findHasSelectorsNode(
node: VCSSSelectorNode
node: VCSSSelectorNode,
):
| (VCSSAtRule & { name: "nest"; selectors: VCSSSelectorNode[] })
| VCSSStyleRule
Expand Down Expand Up @@ -102,7 +102,7 @@ export = {
const ruleNode = findHasSelectorsNode(node);
if (
!ruleNode?.nodes.every(
(n) => isVCSSDeclarationProperty(n) || isVCSSComment(n)
(n) => isVCSSDeclarationProperty(n) || isVCSSComment(n),
)
) {
// Maybe includes nesting
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/v-deep-pseudo-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export = {
nodeText.replace(
/^(\s*)(?::deep|::v-deep)(\s*\()/u,
(_, prefix: string, suffix: string) =>
`${prefix}${expected}${suffix}`
)
`${prefix}${expected}${suffix}`,
),
);
},
});
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/v-global-pseudo-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export = {
nodeText.replace(
/^(\s*)(?::global|::v-global)(\s*\()/u,
(_, prefix: string, suffix: string) =>
`${prefix}${expected}${suffix}`
)
`${prefix}${expected}${suffix}`,
),
);
},
});
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/v-slotted-pseudo-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export = {
nodeText.replace(
/^(\s*)(?::slotted|::v-slotted)(\s*\()/u,
(_, prefix: string, suffix: string) =>
`${prefix}${expected}${suffix}`
)
`${prefix}${expected}${suffix}`,
),
);
},
});
Expand Down
Loading