Skip to content

Commit ae17ac1

Browse files
committed
chore: run prettier after config change
1 parent a3c19e2 commit ae17ac1

File tree

147 files changed

+16858
-16858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+16858
-16858
lines changed

.eslintrc.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
module.exports = {
2-
root: true,
3-
extends: '@sveltejs',
4-
plugins: ['import'],
5-
env: {
6-
node: true
7-
},
8-
rules: {
9-
// enabling these rules makes the linting extremely slow.
10-
// (it's conceivable some subset of them could be enabled without impacting speed)
11-
// see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
12-
'import/named': 'off',
13-
'import/namespace': 'off',
14-
'import/default': 'off',
15-
'import/no-named-as-default-member': 'off',
16-
'import/no-named-as-default': 'off',
17-
'import/no-cycle': 'off',
18-
'import/no-unused-modules': 'off',
19-
'import/no-deprecated': 'off',
20-
// project-specific settings
21-
'max-len': ['error', { code: 100, ignoreComments: true, ignoreStrings: true }],
22-
'no-trailing-spaces': 'error',
23-
'one-var': ['error', 'never'],
24-
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
25-
'@typescript-eslint/no-namespace': 'warn',
26-
'@typescript-eslint/no-non-null-assertion': 'warn',
27-
// exclude workspace dependencies
28-
'import/no-unresolved': [2, { ignore: ['svelte-language-server'] }]
29-
}
2+
root: true,
3+
extends: '@sveltejs',
4+
plugins: ['import'],
5+
env: {
6+
node: true
7+
},
8+
rules: {
9+
// enabling these rules makes the linting extremely slow.
10+
// (it's conceivable some subset of them could be enabled without impacting speed)
11+
// see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
12+
'import/named': 'off',
13+
'import/namespace': 'off',
14+
'import/default': 'off',
15+
'import/no-named-as-default-member': 'off',
16+
'import/no-named-as-default': 'off',
17+
'import/no-cycle': 'off',
18+
'import/no-unused-modules': 'off',
19+
'import/no-deprecated': 'off',
20+
// project-specific settings
21+
'max-len': ['error', { code: 100, ignoreComments: true, ignoreStrings: true }],
22+
'no-trailing-spaces': 'error',
23+
'one-var': ['error', 'never'],
24+
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
25+
'@typescript-eslint/no-namespace': 'warn',
26+
'@typescript-eslint/no-non-null-assertion': 'warn',
27+
// exclude workspace dependencies
28+
'import/no-unresolved': [2, { ignore: ['svelte-language-server'] }]
29+
}
3030
};

.prettierrc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"arrowParens": "always",
3-
"useTabs": true,
4-
"printWidth": 100,
5-
"tabWidth": 4,
6-
"semi": true,
7-
"trailingComma": "none",
8-
"singleQuote": true
2+
"arrowParens": "always",
3+
"useTabs": true,
4+
"printWidth": 100,
5+
"tabWidth": 4,
6+
"semi": true,
7+
"trailingComma": "none",
8+
"singleQuote": true
99
}

packages/language-server/src/importPackage.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,46 @@ import { Logger } from './logger';
1010
* so it's not transformed.
1111
*/
1212
function dynamicRequire(dynamicFileToRequire: string): any {
13-
// prettier-ignore
14-
return require(dynamicFileToRequire);
13+
// prettier-ignore
14+
return require(dynamicFileToRequire);
1515
}
1616

1717
export function getPackageInfo(packageName: string, fromPath: string) {
18-
const packageJSONPath = require.resolve(`${packageName}/package.json`, {
19-
paths: [fromPath, __dirname]
20-
});
21-
// eslint-disable-next-line @typescript-eslint/no-var-requires
22-
const { version } = dynamicRequire(packageJSONPath);
23-
const [major, minor, patch] = version.split('.');
18+
const packageJSONPath = require.resolve(`${packageName}/package.json`, {
19+
paths: [fromPath, __dirname]
20+
});
21+
// eslint-disable-next-line @typescript-eslint/no-var-requires
22+
const { version } = dynamicRequire(packageJSONPath);
23+
const [major, minor, patch] = version.split('.');
2424

25-
return {
26-
path: dirname(packageJSONPath),
27-
version: {
28-
full: version,
29-
major,
30-
minor,
31-
patch
32-
}
33-
};
25+
return {
26+
path: dirname(packageJSONPath),
27+
version: {
28+
full: version,
29+
major,
30+
minor,
31+
patch
32+
}
33+
};
3434
}
3535

3636
export function importPrettier(fromPath: string): typeof prettier {
37-
const pkg = getPackageInfo('prettier', fromPath);
38-
const main = resolve(pkg.path);
39-
Logger.log('Using Prettier v' + pkg.version.full, 'from', main);
40-
return dynamicRequire(main);
37+
const pkg = getPackageInfo('prettier', fromPath);
38+
const main = resolve(pkg.path);
39+
Logger.log('Using Prettier v' + pkg.version.full, 'from', main);
40+
return dynamicRequire(main);
4141
}
4242

4343
export function importSvelte(fromPath: string): typeof svelte {
44-
const pkg = getPackageInfo('svelte', fromPath);
45-
const main = resolve(pkg.path, 'compiler');
46-
Logger.log('Using Svelte v' + pkg.version.full, 'from', main);
47-
return dynamicRequire(main);
44+
const pkg = getPackageInfo('svelte', fromPath);
45+
const main = resolve(pkg.path, 'compiler');
46+
Logger.log('Using Svelte v' + pkg.version.full, 'from', main);
47+
return dynamicRequire(main);
4848
}
4949

5050
export function importSveltePreprocess(fromPath: string): typeof sveltePreprocess {
51-
const pkg = getPackageInfo('svelte-preprocess', fromPath);
52-
const main = resolve(pkg.path);
53-
Logger.log('Using svelte-preprocess v' + pkg.version.full, 'from', main);
54-
return dynamicRequire(main);
51+
const pkg = getPackageInfo('svelte-preprocess', fromPath);
52+
const main = resolve(pkg.path);
53+
Logger.log('Using svelte-preprocess v' + pkg.version.full, 'from', main);
54+
return dynamicRequire(main);
5555
}

packages/language-server/src/lib/DiagnosticsManager.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ export type SendDiagnostics = _Connection['sendDiagnostics'];
55
export type GetDiagnostics = (doc: TextDocumentIdentifier) => Thenable<Diagnostic[]>;
66

77
export class DiagnosticsManager {
8-
constructor(
9-
private sendDiagnostics: SendDiagnostics,
10-
private docManager: DocumentManager,
11-
private getDiagnostics: GetDiagnostics
12-
) {}
8+
constructor(
9+
private sendDiagnostics: SendDiagnostics,
10+
private docManager: DocumentManager,
11+
private getDiagnostics: GetDiagnostics
12+
) {}
1313

14-
updateAll() {
15-
this.docManager.getAllOpenedByClient().forEach((doc) => {
16-
this.update(doc[1]);
17-
});
18-
}
14+
updateAll() {
15+
this.docManager.getAllOpenedByClient().forEach((doc) => {
16+
this.update(doc[1]);
17+
});
18+
}
1919

20-
async update(document: Document) {
21-
const diagnostics = await this.getDiagnostics({ uri: document.getURL() });
22-
this.sendDiagnostics({
23-
uri: document.getURL(),
24-
diagnostics
25-
});
26-
}
20+
async update(document: Document) {
21+
const diagnostics = await this.getDiagnostics({ uri: document.getURL() });
22+
this.sendDiagnostics({
23+
uri: document.getURL(),
24+
diagnostics
25+
});
26+
}
2727

28-
removeDiagnostics(document: Document) {
29-
this.sendDiagnostics({
30-
uri: document.getURL(),
31-
diagnostics: []
32-
});
33-
}
28+
removeDiagnostics(document: Document) {
29+
this.sendDiagnostics({
30+
uri: document.getURL(),
31+
diagnostics: []
32+
});
33+
}
3434
}

packages/language-server/src/lib/documents/Document.ts

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -9,76 +9,76 @@ import { HTMLDocument } from 'vscode-html-languageservice';
99
* Represents a text document contains a svelte component.
1010
*/
1111
export class Document extends WritableDocument {
12-
languageId = 'svelte';
13-
scriptInfo: TagInformation | null = null;
14-
moduleScriptInfo: TagInformation | null = null;
15-
styleInfo: TagInformation | null = null;
16-
config!: SvelteConfig;
17-
html!: HTMLDocument;
12+
languageId = 'svelte';
13+
scriptInfo: TagInformation | null = null;
14+
moduleScriptInfo: TagInformation | null = null;
15+
styleInfo: TagInformation | null = null;
16+
config!: SvelteConfig;
17+
html!: HTMLDocument;
1818

19-
constructor(public url: string, public content: string) {
20-
super();
21-
this.updateDocInfo();
22-
}
19+
constructor(public url: string, public content: string) {
20+
super();
21+
this.updateDocInfo();
22+
}
2323

24-
private updateDocInfo() {
25-
if (!this.config || this.config.loadConfigError) {
26-
this.config = loadConfig(this.getFilePath() || '');
27-
}
28-
this.html = parseHtml(this.content);
29-
const scriptTags = extractScriptTags(this.content, this.html);
30-
this.scriptInfo = this.addDefaultLanguage(scriptTags?.script || null, 'script');
31-
this.moduleScriptInfo = this.addDefaultLanguage(scriptTags?.moduleScript || null, 'script');
32-
this.styleInfo = this.addDefaultLanguage(extractStyleTag(this.content, this.html), 'style');
33-
}
24+
private updateDocInfo() {
25+
if (!this.config || this.config.loadConfigError) {
26+
this.config = loadConfig(this.getFilePath() || '');
27+
}
28+
this.html = parseHtml(this.content);
29+
const scriptTags = extractScriptTags(this.content, this.html);
30+
this.scriptInfo = this.addDefaultLanguage(scriptTags?.script || null, 'script');
31+
this.moduleScriptInfo = this.addDefaultLanguage(scriptTags?.moduleScript || null, 'script');
32+
this.styleInfo = this.addDefaultLanguage(extractStyleTag(this.content, this.html), 'style');
33+
}
3434

35-
/**
36-
* Get text content
37-
*/
38-
getText(): string {
39-
return this.content;
40-
}
35+
/**
36+
* Get text content
37+
*/
38+
getText(): string {
39+
return this.content;
40+
}
4141

42-
/**
43-
* Set text content and increase the document version
44-
*/
45-
setText(text: string) {
46-
this.content = text;
47-
this.version++;
48-
this.updateDocInfo();
49-
}
42+
/**
43+
* Set text content and increase the document version
44+
*/
45+
setText(text: string) {
46+
this.content = text;
47+
this.version++;
48+
this.updateDocInfo();
49+
}
5050

51-
/**
52-
* Returns the file path if the url scheme is file
53-
*/
54-
getFilePath(): string | null {
55-
return urlToPath(this.url);
56-
}
51+
/**
52+
* Returns the file path if the url scheme is file
53+
*/
54+
getFilePath(): string | null {
55+
return urlToPath(this.url);
56+
}
5757

58-
/**
59-
* Get URL file path.
60-
*/
61-
getURL() {
62-
return this.url;
63-
}
58+
/**
59+
* Get URL file path.
60+
*/
61+
getURL() {
62+
return this.url;
63+
}
6464

65-
private addDefaultLanguage(
66-
tagInfo: TagInformation | null,
67-
tag: 'style' | 'script'
68-
): TagInformation | null {
69-
if (!tagInfo) {
70-
return null;
71-
}
65+
private addDefaultLanguage(
66+
tagInfo: TagInformation | null,
67+
tag: 'style' | 'script'
68+
): TagInformation | null {
69+
if (!tagInfo) {
70+
return null;
71+
}
7272

73-
const defaultLang = Array.isArray(this.config.preprocess)
74-
? this.config.preprocess.find((group) => group.defaultLanguages?.[tag])
75-
?.defaultLanguages?.[tag]
76-
: this.config.preprocess?.defaultLanguages?.[tag];
73+
const defaultLang = Array.isArray(this.config.preprocess)
74+
? this.config.preprocess.find((group) => group.defaultLanguages?.[tag])
75+
?.defaultLanguages?.[tag]
76+
: this.config.preprocess?.defaultLanguages?.[tag];
7777

78-
if (!tagInfo.attributes.lang && !tagInfo.attributes.type && defaultLang) {
79-
tagInfo.attributes.lang = defaultLang;
80-
}
78+
if (!tagInfo.attributes.lang && !tagInfo.attributes.type && defaultLang) {
79+
tagInfo.attributes.lang = defaultLang;
80+
}
8181

82-
return tagInfo;
83-
}
82+
return tagInfo;
83+
}
8484
}

0 commit comments

Comments
 (0)