Skip to content

chore(deps): update dependency prettier to v3 #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 19, 2023
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
6 changes: 3 additions & 3 deletions benchmark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { parseForESLint as parseOld } from "../node_modules/svelte-eslint-parser

const contents = `${fs.readFileSync(
require.resolve("../explorer-v2/src/lib/RulesSettings.svelte"),
"utf-8"
"utf-8",
)}// comments`;

type Result = { name: string; hz: number };
Expand All @@ -34,8 +34,8 @@ function onComplete(): void {
for (const name of Object.keys(map)) {
console.log(
`${name.padEnd(15)} ${format(
map[name].reduce((p, a) => p + a, 0) / map[name].length
)} ops/sec`
map[name].reduce((p, a) => p + a, 0) / map[name].length,
)} ops/sec`,
);
}
for (let i = 0; i < results.length; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions explorer-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"devDependencies": {
"@sveltejs/adapter-static": "^2.0.0",
"@sveltejs/kit": "^1.0.0-next.456",
"prettier": "^2.3.0",
"prettier-plugin-svelte": "^2.3.0",
"prettier": "^3.0.0",
"prettier-plugin-svelte": "^3.0.0",
"string-replace-loader": "^3.0.1",
"typescript": "^5.0.4",
"vite": "^4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"eslint-plugin-jsonc": "^2.8.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-node-dependencies": "^0.11.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-regexp": "^1.15.0",
"eslint-plugin-svelte": "^2.30.0",
"eslint-plugin-yml": "^1.7.0",
Expand All @@ -98,9 +98,9 @@
"mocha": "^10.2.0",
"mocha-chai-jest-snapshot": "^1.1.4",
"nyc": "^15.1.0",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"prettier-plugin-pkg": "^0.18.0",
"prettier-plugin-svelte": "^2.10.1",
"prettier-plugin-svelte": "^3.0.0",
"rimraf": "^5.0.1",
"semver": "^7.5.1",
"svelte": "^4.0.0",
Expand Down
28 changes: 14 additions & 14 deletions src/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ScriptsSourceCode {

public constructor(
script: string,
attrs: Record<string, string | undefined>
attrs: Record<string, string | undefined>,
) {
this.raw = script;
this.trimmedRaw = script.trimEnd();
Expand Down Expand Up @@ -170,12 +170,12 @@ export class Context {
// It will be restored later in `convertHTMLElement()` processing.
templateCode += `${code.slice(
start,
block.startTagRange[0] + 2 /* `<` and first letter */
block.startTagRange[0] + 2 /* `<` and first letter */,
)}${"-".repeat(
block.tag.length - 1 /* skip first letter */
block.tag.length - 1 /* skip first letter */,
)}${code.slice(
block.startTagRange[0] + 1 /* skip `<` */ + block.tag.length,
block.startTagRange[1]
block.startTagRange[1],
)}`;
scriptCode += spaces.slice(start, block.startTagRange[1]);
start = block.startTagRange[1];
Expand Down Expand Up @@ -227,7 +227,7 @@ export class Context {
* @param node The node.
*/
public getConvertLocation(
node: { start: number; end: number } | ESTree.Node
node: { start: number; end: number } | ESTree.Node,
): Locations {
const { start, end } = node as any;

Expand All @@ -249,7 +249,7 @@ export class Context {
*/
public addToken(
type: Token["type"],
range: { start: number; end: number }
range: { start: number; end: number },
): Token {
const token = {
type,
Expand Down Expand Up @@ -277,7 +277,7 @@ export class Context {
}
const parserValue = getParserForLang(
this.sourceCode.scripts.attrs,
this.parserOptions?.parser
this.parserOptions?.parser,
);
if (typeof parserValue !== "string") {
return (this.state.isTypeScript =
Expand All @@ -295,7 +295,7 @@ export class Context {
if (fs.existsSync(pkgPath)) {
try {
return (this.state.isTypeScript = TS_PARSER_NAMES.includes(
JSON.parse(fs.readFileSync(pkgPath, "utf-8"))?.name
JSON.parse(fs.readFileSync(pkgPath, "utf-8"))?.name,
));
} catch {
return (this.state.isTypeScript = false);
Expand All @@ -317,7 +317,7 @@ export class Context {
}

public findBlock(
element: SvelteScriptElement | SvelteStyleElement | SvelteElement
element: SvelteScriptElement | SvelteStyleElement | SvelteElement,
): Block | undefined {
const tag =
element.type === "SvelteScriptElement"
Expand All @@ -330,19 +330,19 @@ export class Context {
block.tag === tag &&
!block.selfClosing &&
element.range[0] <= block.contentRange[0] &&
block.contentRange[1] <= element.range[1]
block.contentRange[1] <= element.range[1],
);
}

public findSelfClosingBlock(
element: SvelteElement
element: SvelteElement,
): SelfClosingBlock | undefined {
return this.blocks.find((block): block is SelfClosingBlock =>
Boolean(
block.selfClosing &&
element.startTag.range[0] <= block.startTagRange[0] &&
block.startTagRange[1] <= element.startTag.range[1]
)
block.startTagRange[1] <= element.startTag.range[1],
),
);
}
}
Expand Down Expand Up @@ -453,7 +453,7 @@ export class LinesAndColumns {
public getLocFromIndex(index: number): { line: number; column: number } {
const lineNumber = sortedLastIndex(
this.lineStartIndices,
(target) => target - index
(target) => target - index,
);
return {
line: lineNumber,
Expand Down
Loading