Skip to content

Commit

Permalink
Merge d5880ec into b3e4933
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] committed Jul 14, 2023
2 parents b3e4933 + d5880ec commit 3764ab9
Show file tree
Hide file tree
Showing 37 changed files with 186 additions and 180 deletions.
8 changes: 4 additions & 4 deletions docs/.vuepress/components/components/EslintPluginEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,26 +164,26 @@ export default {
monaco.languages.register({ id: "toml" });
monaco.languages.setMonarchTokensProvider(
"toml",
require("./languages/toml/toml").language
require("./languages/toml/toml").language,
);
monaco.languages.register({ id: "yaml" });
monaco.languages.setMonarchTokensProvider(
"yaml",
require("monaco-editor/esm/vs/basic-languages/yaml/yaml").language
require("monaco-editor/esm/vs/basic-languages/yaml/yaml").language,
);
});
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
4 changes: 2 additions & 2 deletions docs/.vuepress/components/rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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 @@ -81,7 +81,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 @@ -37,7 +37,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
12 changes: 6 additions & 6 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,31 @@ module.exports = {
eslint$: path.resolve(__dirname, "./shim/eslint"),
"eslint-visitor-keys$": path.resolve(
__dirname,
"./shim/eslint-visitor-keys"
"./shim/eslint-visitor-keys",
),
ajv: path.resolve(
require.resolve("eslint/package.json"),
"../node_modules/ajv"
"../node_modules/ajv",
),
[path.resolve(__dirname, "../../lib/utils/ajv")]: path.resolve(
__dirname,
"../../node_modules/ajv"
"../../node_modules/ajv",
),
synckit: require.resolve("./shim/synckit"),
// Adjust the yaml path as it gets confusing.
yaml$: path.resolve(
__dirname,
"../../node_modules/yaml/dist/index.js"
"../../node_modules/yaml/dist/index.js",
),
// Adjust the esquery path as it gets confusing.
esquery: path.resolve(
__dirname,
"../../node_modules/esquery/dist/esquery.min.js"
"../../node_modules/esquery/dist/esquery.min.js",
),
// Adjust the @eslint/eslintrc path as it gets confusing.
"@eslint/eslintrc/universal": path.resolve(
__dirname,
"../../node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs"
"../../node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs",
),
},
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-node-dependencies": "^0.11.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-regexp": "^1.0.0",
"eslint-plugin-toml": "^0.5.0",
"eslint-plugin-vue": "^9.0.0",
Expand All @@ -96,7 +96,7 @@
"mocha": "^10.0.0",
"monaco-editor": "^0.40.0",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"prettier": "^3.0.0",
"prettier-plugin-pkg": "^0.17.0",
"raw-loader": "^4.0.1",
"request": "^2.88.2",
Expand Down
11 changes: 7 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ const configs = {
recommended,
};

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

export = {
meta,
Expand Down
18 changes: 9 additions & 9 deletions src/rules/no-invalid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function parseOption(
}
| string,
context: RuleContext,
filename: string
filename: string,
): Validator | null {
if (typeof option === "string") {
return schemaPathToValidator(option, context);
Expand Down Expand Up @@ -127,7 +127,7 @@ function parseOption(
*/
function schemaPathToValidator(
schemaPath: string,
context: RuleContext
context: RuleContext,
): Validator | null {
const schema = loadSchema(schemaPath, context);
if (!schema) {
Expand All @@ -141,7 +141,7 @@ function schemaPathToValidator(
*/
function schemaObjectToValidator(
schema: SchemaObject | null,
context: RuleContext
context: RuleContext,
): Validator | null {
if (!schema) {
return null;
Expand Down Expand Up @@ -228,7 +228,7 @@ export default createRule("no-invalid", {
const v = parseOption(
context.options[0] || {},
context,
filename.startsWith(cwd) ? path.relative(cwd, filename) : filename
filename.startsWith(cwd) ? path.relative(cwd, filename) : filename,
);
if (!v) {
return {};
Expand All @@ -244,7 +244,7 @@ export default createRule("no-invalid", {
*/
function validateData(
data: unknown,
resolveLoc: (error: ValidateError) => JSONAST.SourceLocation | null
resolveLoc: (error: ValidateError) => JSONAST.SourceLocation | null,
) {
const errors = validator!(data);
for (const error of errors) {
Expand All @@ -267,7 +267,7 @@ export default createRule("no-invalid", {
*/
function validateJSExport(
node: ESLintExpression,
rootRange: [number, number]
rootRange: [number, number],
) {
if (existsExports) {
return;
Expand Down Expand Up @@ -371,7 +371,7 @@ export default createRule("no-invalid", {
* ErrorData to report location.
*/
function errorDataToLoc(
errorData: NodeData<JSONAST.JSONNode | YAML.YAMLNode | TOML.TOMLNode>
errorData: NodeData<JSONAST.JSONNode | YAML.YAMLNode | TOML.TOMLNode>,
) {
if (errorData.key) {
const range = errorData.key(sourceCode);
Expand Down Expand Up @@ -439,9 +439,9 @@ export default createRule("no-invalid", {
path.dirname(
typeof context.getPhysicalFilename === "function"
? context.getPhysicalFilename()
: getPhysicalFilename(context.getFilename())
: getPhysicalFilename(context.getFilename()),
),
$schema
$schema,
)
: $schema
: null;
Expand Down
22 changes: 11 additions & 11 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface PartialRuleModule {
meta: PartialRuleMetaData;
create(
context: RuleContext,
params: { customBlock: boolean; filename: string }
params: { customBlock: boolean; filename: string },
): RuleListener;
}

Expand Down Expand Up @@ -109,7 +109,7 @@ export interface SourceCode {
getText(
node?: NodeOrToken,
beforeCount?: number,
afterCount?: number
afterCount?: number,
): string;

getLines(): string[];
Expand All @@ -131,7 +131,7 @@ export interface SourceCode {

getTokenByRangeStart(
offset: number,
options?: { includeComments?: boolean }
options?: { includeComments?: boolean },
): Token | null;

getFirstToken(node: Node): Token;
Expand All @@ -147,53 +147,53 @@ export interface SourceCode {
// getTokenBefore(node: NodeOrToken): Token | null
getTokenBefore(
node: NodeOrToken,
options?: CursorWithSkipOptions
options?: CursorWithSkipOptions,
): Token | null;

getTokensBefore(node: NodeOrToken, options?: CursorWithCountOptions): Token[];

// getTokenAfter(node: NodeOrToken): Token | null
getTokenAfter(
node: NodeOrToken,
options?: CursorWithSkipOptions
options?: CursorWithSkipOptions,
): Token | null;

getTokensAfter(node: NodeOrToken, options?: CursorWithCountOptions): Token[];

getFirstTokenBetween(
left: NodeOrToken,
right: NodeOrToken,
options?: CursorWithSkipOptions
options?: CursorWithSkipOptions,
): Token | null;

getFirstTokensBetween(
left: NodeOrToken,
right: NodeOrToken,
options?: CursorWithCountOptions
options?: CursorWithCountOptions,
): Token[];

getLastTokenBetween(
left: NodeOrToken,
right: NodeOrToken,
options?: CursorWithSkipOptions
options?: CursorWithSkipOptions,
): Token | null;

getLastTokensBetween(
left: NodeOrToken,
right: NodeOrToken,
options?: CursorWithCountOptions
options?: CursorWithCountOptions,
): Token[];

getTokensBetween(
left: NodeOrToken,
right: NodeOrToken,
padding?: number | FilterPredicate | CursorWithCountOptions
padding?: number | FilterPredicate | CursorWithCountOptions,
): Token[];

getTokens(node: Node, beforeCount?: number, afterCount?: number): Token[];
getTokens(
node: Node,
options: FilterPredicate | CursorWithCountOptions
options: FilterPredicate | CursorWithCountOptions,
): Token[];

commentsExistBetween(left: NodeOrToken, right: NodeOrToken): boolean;
Expand Down
Loading

0 comments on commit 3764ab9

Please sign in to comment.