Skip to content
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

chore: format repository with tabs #740

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
56 changes: 28 additions & 28 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
module.exports = {
root: true,
extends: '@sveltejs',
plugins: ['import'],
env: {
node: true
},
rules: {
// enabling these rules makes the linting extremely slow.
// (it's conceivable some subset of them could be enabled without impacting speed)
// see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
'import/named': 'off',
'import/namespace': 'off',
'import/default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-named-as-default': 'off',
'import/no-cycle': 'off',
'import/no-unused-modules': 'off',
'import/no-deprecated': 'off',
// project-specific settings
'max-len': ['error', { code: 100, ignoreComments: true, ignoreStrings: true }],
'no-trailing-spaces': 'error',
'one-var': ['error', 'never'],
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
'@typescript-eslint/no-namespace': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
// exclude workspace dependencies
'import/no-unresolved': [2, { ignore: ['svelte-language-server'] }]
}
root: true,
extends: '@sveltejs',
plugins: ['import'],
env: {
node: true
},
rules: {
// enabling these rules makes the linting extremely slow.
// (it's conceivable some subset of them could be enabled without impacting speed)
// see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
'import/named': 'off',
'import/namespace': 'off',
'import/default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-named-as-default': 'off',
'import/no-cycle': 'off',
'import/no-unused-modules': 'off',
'import/no-deprecated': 'off',
// project-specific settings
'max-len': ['error', { code: 100, ignoreComments: true, ignoreStrings: true }],
'no-trailing-spaces': 'error',
'one-var': ['error', 'never'],
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
'@typescript-eslint/no-namespace': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
// exclude workspace dependencies
'import/no-unresolved': [2, { ignore: ['svelte-language-server'] }]
}
};
9 changes: 5 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**System (please complete the following information):**
- OS: [e.g. Windows]
- IDE: [e.g. VSCode, Atom]
- Plugin/Package: [e.g. "Svelte for VSCode", or `svelte-language-server`, `svelte-check`, or `svelte2tsx` if you use one of the npm packages directly]

- OS: [e.g. Windows]
- IDE: [e.g. VSCode, Atom]
- Plugin/Package: [e.g. "Svelte for VSCode", or `svelte-language-server`, `svelte-check`, or `svelte2tsx` if you use one of the npm packages directly]

**Additional context**
Add any other context about the problem here.

<!-- Want to help us out? Read this to get started:
https://github.com/sveltejs/language-tools#development
-->
-->
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Add any other context or screenshots about the feature request here.

<!-- Want to help us out? Read this to get started:
https://github.com/sveltejs/language-tools#development
-->
-->
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/something-else.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ labels: ''
assignees: ''

---


27 changes: 21 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
{
"useTabs": false,
"printWidth": 100,
"tabWidth": 4,
"semi": true,
"trailingComma": "none",
"singleQuote": true
"arrowParens": "always",
"useTabs": true,
"printWidth": 100,
"tabWidth": 4,
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"overrides": [
{
"files": ["package.json"],
"options": {
"tabWidth": 2
}
},
{
"files": ["*.md"],
"options": {
"useTabs": false
}
}
]
}
110 changes: 55 additions & 55 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run VS Code Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}/packages/svelte-vscode"],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/packages/svelte-vscode/dist/**/*.js"],
"preLaunchTask": "npm: watch"
},
{
"type": "node",
"request": "launch",
"name": "Run 'svelte2tsx/repl/debug.ts' with debugger",
"runtimeArgs": ["-r", "ts-node/register"],
"args": ["${workspaceFolder}/packages/svelte2tsx/repl/debug.ts"],
"env": {
"TS_NODE_COMPILER_OPTIONS": "{\"esModuleInterop\":true, \"target\": \"es2018\"}",
"TS_NODE_TRANSPILE_ONLY": "true"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Run tests with debugger",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-r",
"ts-node/register",
"--colors",
"${workspaceFolder}/packages/*/test/**/*.ts"
],
"env": {
"TS_NODE_COMPILER_OPTIONS": "{\"esModuleInterop\":true}"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "attach",
"name": "Attach debugger to language server",
"port": 6009,
"outFiles": [
"${workspaceRoot}/packages/language-server/dist/**/*.js",
"${workspaceRoot}/packages/svelte2tsx/index.js"
],
"skipFiles": ["<node_internals>/**"]
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run VS Code Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}/packages/svelte-vscode"],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/packages/svelte-vscode/dist/**/*.js"],
"preLaunchTask": "npm: watch"
},
{
"type": "node",
"request": "launch",
"name": "Run 'svelte2tsx/repl/debug.ts' with debugger",
"runtimeArgs": ["-r", "ts-node/register"],
"args": ["${workspaceFolder}/packages/svelte2tsx/repl/debug.ts"],
"env": {
"TS_NODE_COMPILER_OPTIONS": "{\"esModuleInterop\":true, \"target\": \"es2018\"}",
"TS_NODE_TRANSPILE_ONLY": "true"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Run tests with debugger",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-r",
"ts-node/register",
"--colors",
"${workspaceFolder}/packages/*/test/**/*.ts"
],
"env": {
"TS_NODE_COMPILER_OPTIONS": "{\"esModuleInterop\":true}"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "attach",
"name": "Attach debugger to language server",
"port": 6009,
"outFiles": [
"${workspaceRoot}/packages/language-server/dist/**/*.js",
"${workspaceRoot}/packages/svelte2tsx/index.js"
],
"skipFiles": ["<node_internals>/**"]
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"typescript.preferences.quoteStyle": "single"
"typescript.preferences.quoteStyle": "single"
}
32 changes: 16 additions & 16 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p>
<a href="https://svelte.dev">
<img alt="Cybernetically enhanced web apps: Svelte" src="https://user-images.githubusercontent.com/49038/76711598-f0b39180-66e7-11ea-9501-37f6e1edf8a6.png">
<img alt="Cybernetically enhanced web apps: Svelte" src="https://user-images.githubusercontent.com/49038/76711598-f0b39180-66e7-11ea-9501-37f6e1edf8a6.png">
</a>

<a href="https://www.npmjs.com/package/svelte">
Expand All @@ -20,7 +20,7 @@ Svelte Language Tools contains a library implementing the Language Server Protoc

A `.svelte` file would look something like this:

```html
```svelte
<script>
let count = 1;

Expand All @@ -33,7 +33,7 @@ A `.svelte` file would look something like this:
}
</script>

<button on:click="{handleClick}">Count: {count}</button>
<button on:click={handleClick}>Count: {count}</button>

<p>{count} * 2 = {doubled}</p>
<p>{doubled} * 2 = {quadrupled}</p>
Expand Down
16 changes: 8 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ LSP-compatible editors, you can use an HTML comment with the `@component` tag:

The VS Code extension comes with its own syntax highlighting grammar which defines special scopes. If your syntax highlighting seems to be not working for Svelte components or you feel that some colors are wrong, you can add something like the following to your `settings.json`:

```
```json
{
"editor.tokenColorCustomizations": {
"[<Name of your theme>]": {
"textMateRules": [
{
"settings": {
"foreground": "#569CD6", // any color you like
"foreground": "#569CD6" // any color you like
},
"scope": "support.class.component.svelte" // scope name you want to adjust highlighting for
}
],
},
]
}
}
}
```
Expand All @@ -80,7 +80,7 @@ You need to save the file to see the changes. If the problem persists after savi

```json
"files.watcherExclude": {
"**/*": true,
"**/*": true,
}
```

Expand All @@ -94,13 +94,13 @@ If you have the `Babel Javascript` plugin installed, this may be the cause. Disa

Your default formatter for Svelte files may be wrong.

- Mabye it's set to the old Svelte extension, if so, remove the setting
- Maybe it's set to the old Svelte extension, if so, remove the setting
- Maybe you set all files to be formatted by the prettier extension. Then you have two options: Either install `prettier-plugin-svelte` from npm, or tell VSCode to format the code with the `Svelte for VSCode extension`:

```json
"[svelte]": {
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
},
```

## Internals
Expand Down
5 changes: 3 additions & 2 deletions docs/internal/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ Our `language-server` can roughly be split into [four areas](/packages/language-
The last area, TS/JS, is where most of the work is done. Svelte is a mix of JavaScript/TypeScript inside `script` and more of it within Svelte's template syntax. To get a holistic view of the file, we need to account for both.
This is also the reason why preprocessors such as `svelte-preprocess` cannot do type checking because it produces wrong diagnostics. To preprocess the script content, it only gets the content from the script. Think of this situation:

```html
```svelte
<script lang="ts">
let a: number = 1;
</script>

{a}
```

Expand Down Expand Up @@ -64,7 +65,7 @@ This example shows how our `language-server` uses `svelte2tsx`:

1. Svelte file comes in

```html
```svelte
<script>
export let world = 'name';
</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/preprocessors/in-general.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {

It's also necessary to add a `type="text/language-name"` or `lang="language-name"` to your `style` and `script` tags, which defines how that code should be interpreted by the extension.

```html
```svelte
<div>
<h1>Hello, world!</h1>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/preprocessors/scss-less.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {

To gain syntax highlighing for your SCSS code and to make us understand the language you are using, add a `type` or `lang` attribute to your style tags like so:

```html
```svelte
<!-- Add type="text/scss" -->
<style type="text/scss">
header {
Expand Down
Loading