Skip to content

Commit 29b7f22

Browse files
committed
style: apply prettier
1 parent 348954a commit 29b7f22

File tree

9 files changed

+146
-117
lines changed

9 files changed

+146
-117
lines changed

.eslintrc.cjs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
module.exports = {
2-
root: true,
3-
parser: '@typescript-eslint/parser',
4-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
5-
plugins: ['svelte3', '@typescript-eslint'],
6-
ignorePatterns: ['*.cjs'],
7-
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
8-
settings: {
9-
'svelte3/typescript': () => require('typescript')
10-
},
11-
parserOptions: {
12-
sourceType: 'module',
13-
ecmaVersion: 2020
14-
},
15-
env: {
16-
browser: true,
17-
es2017: true,
18-
node: true
19-
}
2+
root: true,
3+
parser: "@typescript-eslint/parser",
4+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
5+
plugins: ["svelte3", "@typescript-eslint"],
6+
ignorePatterns: ["*.cjs"],
7+
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
8+
settings: {
9+
"svelte3/typescript": () => require("typescript"),
10+
},
11+
parserOptions: {
12+
sourceType: "module",
13+
ecmaVersion: 2020,
14+
},
15+
env: {
16+
browser: true,
17+
es2017: true,
18+
node: true,
19+
},
2020
};

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright (c) 2022 Touchify
2+
3+
4+
Permission is hereby granted, free of charge, to any person
5+
obtaining a copy of this software and associated documentation
6+
files (the "Software"), to deal in the Software without restriction,
7+
including without limitation the rights to use, copy, modify, merge,
8+
publish, distribute, sublicense, and/or sell copies of the Software,
9+
and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
21+
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# svelte-codemirror-editor
22

3+
![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4+
[![NPM version](https://img.shields.io/npm/v/svelte-codemirror-editor.svg?style=flat-square)](https://npmjs.org/package/svelte-codemirror-editor)
5+
[![NPM download](https://img.shields.io/npm/dm/svelte-codemirror-editor.svg?style=flat-square)](https://npmjs.org/package/svelte-codemirror-editor)
6+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
7+
38
A svelte component to create a [CodeMirror 6](https://codemirror.net/6/) editor.
49

510
## Installation
611

712
```bash
8-
# create a new project in the current directory
913
npm install svelte-codemirror-editor
1014
```
1115

@@ -26,19 +30,19 @@ To use `svelte-codemirror-editor`, you need to import the package and use it as
2630

2731
## Properties
2832

29-
| Property | Type | Description | Default value |
30-
| --------- | ----------------- | --------------------------------------------------------------------------------------------- | ------------- |
31-
| `value` | `string` | The value that will be displayed and edited in the CodeMirror editor | `""` |
32-
| `basic` | `boolean` | Whether to use CodeMirror `basicSetup` extensions. | `true` |
33-
| `lang` | `LanguageSupport` | The language extension that will parse and highlight the value. | `undefined` |
34-
| `theme` | `Extension` | The theme extension to customize the appearence of the editor. | `undefined` |
35-
| `extensions` | `Extension[]` | Additional extensions to inject in the editor. | `[]` |
36-
| `useTab` | `boolean` | Whether to use the `Tab` shortcut to handle indentation. | `true` |
37-
| `tabSize` | `number` | The number of space of an indentation level. | `2` |
38-
| `editable` | `boolean` | Whether to make the editor editable or not. | `true` |
39-
| `readonly` | `boolean` | Whether to make the editor readonly or not. | `false` |
40-
| `placeholder` | `string` | A placeholder to include when value is empty. | `undefined` |
41-
| `styles` | `ThemeSpec` | In-place theme configuration. *See exemple below*. | `undefined` |
33+
| Property | Type | Description | Default value |
34+
| ------------- | ----------------- | -------------------------------------------------------------------- | ------------- |
35+
| `value` | `string` | The value that will be displayed and edited in the CodeMirror editor | `""` |
36+
| `basic` | `boolean` | Whether to use CodeMirror `basicSetup` extensions. | `true` |
37+
| `lang` | `LanguageSupport` | The language extension that will parse and highlight the value. | `undefined` |
38+
| `theme` | `Extension` | The theme extension to customize the appearence of the editor. | `undefined` |
39+
| `extensions` | `Extension[]` | Additional extensions to inject in the editor. | `[]` |
40+
| `useTab` | `boolean` | Whether to use the `Tab` shortcut to handle indentation. | `true` |
41+
| `tabSize` | `number` | The number of space of an indentation level. | `2` |
42+
| `editable` | `boolean` | Whether to make the editor editable or not. | `true` |
43+
| `readonly` | `boolean` | Whether to make the editor readonly or not. | `false` |
44+
| `placeholder` | `string` | A placeholder to include when value is empty. | `undefined` |
45+
| `styles` | `ThemeSpec` | In-place theme configuration. _See exemple below_. | `undefined` |
4246

4347
## Events
4448

@@ -85,15 +89,15 @@ To use `svelte-codemirror-editor`, you need to import the package and use it as
8589
let value = "";
8690
</script>
8791
88-
<CodeMirror
89-
bind:value
90-
lang={javascript()}
92+
<CodeMirror
93+
bind:value
94+
lang={javascript()}
9195
styles={{
9296
"&": {
9397
width: "500px",
9498
maxWidth: "100%",
95-
height: "50rem"
96-
}
99+
height: "50rem",
100+
},
97101
}}
98102
/>
99103
```

package.json

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
{
2-
"name": "svelte-codemirror-editor",
3-
"description": "A svelte component to create a CodeMirror 6+ editor",
4-
"version": "0.0.1",
5-
"type": "module",
6-
"author": {
7-
"name": "Touchify",
8-
"email": "[email protected]",
9-
"url": "https://touchify.io"
10-
},
11-
"repository": {
12-
"type": "git",
13-
"url": "https://github.com/touchifyapp/svelte-codemirror-editor"
14-
},
15-
"scripts": {
16-
"dev": "svelte-kit dev",
17-
"build": "svelte-kit build",
18-
"package": "svelte-kit package",
19-
"preview": "svelte-kit preview",
20-
"prepare": "svelte-kit sync",
21-
"check": "svelte-check --tsconfig ./tsconfig.json",
22-
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
23-
"lint": "prettier --check --plugin-search-dir=. . && eslint .",
24-
"format": "prettier --write --plugin-search-dir=. ."
25-
},
26-
"peerDependencies": {
27-
"codemirror": "^6.0.0"
28-
},
29-
"devDependencies": {
2+
"name": "svelte-codemirror-editor",
3+
"description": "A svelte component to create a CodeMirror 6+ editor",
4+
"version": "0.0.1",
5+
"type": "module",
6+
"license": "MIT",
7+
"author": {
8+
"name": "Touchify",
9+
"email": "[email protected]",
10+
"url": "https://touchify.io"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/touchifyapp/svelte-codemirror-editor"
15+
},
16+
"scripts": {
17+
"dev": "svelte-kit dev",
18+
"build": "svelte-kit build",
19+
"package": "svelte-kit package",
20+
"preview": "svelte-kit preview",
21+
"prepare": "svelte-kit sync",
22+
"test": "npm run lint && npm run check",
23+
"check": "svelte-check --tsconfig ./tsconfig.json",
24+
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
25+
"lint": "prettier --check --plugin-search-dir=. . && eslint .",
26+
"format": "prettier --write --plugin-search-dir=. ."
27+
},
28+
"peerDependencies": {
29+
"codemirror": "^6.0.0"
30+
},
31+
"devDependencies": {
3032
"@codemirror/lang-css": "^6.0.0",
3133
"@codemirror/lang-html": "^6.0.0",
3234
"@codemirror/lang-javascript": "^6.0.0",
33-
"@codemirror/theme-one-dark": "^6.0.0",
34-
"@sveltejs/kit": "next",
35-
"@typescript-eslint/eslint-plugin": "^5.27.0",
36-
"@typescript-eslint/parser": "^5.27.0",
37-
"codemirror": "^6.0.0",
38-
"eslint": "^8.16.0",
39-
"eslint-config-prettier": "^8.3.0",
40-
"eslint-plugin-svelte3": "^4.0.0",
41-
"prettier": "^2.6.2",
42-
"prettier-plugin-svelte": "^2.7.0",
43-
"svelte": "^3.44.0",
44-
"svelte-check": "^2.7.1",
45-
"svelte-preprocess": "^4.10.6",
35+
"@codemirror/theme-one-dark": "^6.0.0",
36+
"@sveltejs/kit": "next",
37+
"@typescript-eslint/eslint-plugin": "^5.27.0",
38+
"@typescript-eslint/parser": "^5.27.0",
39+
"codemirror": "^6.0.0",
40+
"eslint": "^8.16.0",
41+
"eslint-config-prettier": "^8.3.0",
42+
"eslint-plugin-svelte3": "^4.0.0",
43+
"prettier": "^2.6.2",
44+
"prettier-plugin-svelte": "^2.7.0",
45+
"svelte": "^3.44.0",
46+
"svelte-check": "^2.7.1",
47+
"svelte-preprocess": "^4.10.6",
4648
"svelte2tsx": "^0.5.10",
47-
"tslib": "^2.3.1",
48-
"typescript": "^4.7.2"
49-
}
50-
}
49+
"tslib": "^2.3.1",
50+
"typescript": "^4.7.2"
51+
}
52+
}

src/app.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// See https://kit.svelte.dev/docs/types#app
44
// for information about these interfaces
55
declare namespace App {
6-
// interface Locals {}
7-
// interface Platform {}
8-
// interface Session {}
9-
// interface Stuff {}
6+
// interface Locals {}
7+
// interface Platform {}
8+
// interface Session {}
9+
// interface Stuff {}
1010
}

src/app.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1" />
6-
%sveltekit.head%
7-
</head>
8-
<body>
9-
<div>%sveltekit.body%</div>
10-
</body>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
%sveltekit.head%
7+
</head>
8+
<body>
9+
<div>%sveltekit.body%</div>
10+
</body>
1111
</html>

src/styles.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ html {
22
font-family: sans-serif;
33
}
44

5-
html, body {
5+
html,
6+
body {
67
margin: 0;
78
padding: 0;
89
}
@@ -13,11 +14,12 @@ html, body {
1314
box-sizing: border-box;
1415
}
1516

16-
.editor, .editor .cm-editor {
17+
.editor,
18+
.editor .cm-editor {
1719
height: 100%;
1820
}
1921

2022
input,
2123
select {
2224
outline: none;
23-
}
25+
}

svelte.config.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
import preprocess from 'svelte-preprocess';
1+
import preprocess from "svelte-preprocess";
22

33
/** @type {import('@sveltejs/kit').Config} */
44
const config = {
5-
// Consult https://github.com/sveltejs/svelte-preprocess
6-
// for more information about preprocessors
7-
preprocess: preprocess(),
5+
preprocess: preprocess(),
86

9-
kit: {
7+
kit: {
108
package: {
119
exports(filepath) {
1210
return filepath.endsWith("package.json") || filepath.endsWith("index.ts");
1311
},
1412
},
1513
vite: {
1614
optimizeDeps: {
17-
exclude: ["codemirror"]
18-
}
19-
}
20-
}
15+
exclude: ["codemirror"],
16+
},
17+
},
18+
},
2119
};
2220

2321
export default config;

tsconfig.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"extends": "./.svelte-kit/tsconfig.json",
3-
"compilerOptions": {
4-
"allowJs": true,
5-
"checkJs": true,
6-
"esModuleInterop": true,
7-
"forceConsistentCasingInFileNames": true,
8-
"resolveJsonModule": true,
9-
"skipLibCheck": true,
10-
"sourceMap": true,
11-
"strict": true
12-
}
2+
"extends": "./.svelte-kit/tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"checkJs": true,
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"resolveJsonModule": true,
9+
"skipLibCheck": true,
10+
"sourceMap": true,
11+
"strict": true
12+
}
1313
}

0 commit comments

Comments
 (0)