Skip to content

Commit ac05ca5

Browse files
authored
EditorConfig & ESLint Improvements (#14)
1 parent 950c020 commit ac05ca5

File tree

10 files changed

+1751
-206
lines changed

10 files changed

+1751
-206
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@
2323
"onAutoForward": "openBrowser"
2424
}
2525
},
26-
"forwardPorts": [8283]
26+
"forwardPorts": [
27+
8283
28+
]
2729
}

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
insert_final_newline = true
8+
9+
[*.{js,ts}]
10+
indent_size = 4
11+
12+
[*.{json,md,yml}]
13+
indent_size = 2

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.vscode/extensions.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"recommendations": [
3-
"bierner.markdown-preview-github-styles",
4-
"dbaeumer.vscode-eslint",
5-
"github.vscode-github-actions"
6-
]
7-
}
2+
"recommendations": [
3+
"bierner.markdown-preview-github-styles",
4+
"dbaeumer.vscode-eslint",
5+
"github.vscode-github-actions"
6+
]
7+
}

.vscode/launch.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
"type": "node-terminal",
6-
"request": "launch",
7-
"name": "matterbridge",
8-
"preLaunchTask": "npm: build",
9-
"command": "npm run matterbridge",
10-
"skipFiles": [
11-
"<node_internals>/**"
12-
]
13-
}
14-
]
15-
}
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node-terminal",
6+
"request": "launch",
7+
"name": "matterbridge",
8+
"preLaunchTask": "npm: build",
9+
"command": "npm run matterbridge",
10+
"skipFiles": [
11+
"<node_internals>/**"
12+
]
13+
}
14+
]
15+
}

.vscode/settings.json

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,46 @@
11
{
2-
"editor.codeActionsOnSave": {
3-
"source.fixAll.eslint": "always"
4-
},
5-
"eslint.format.enable": true,
6-
"[javascript]": {
7-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
8-
},
9-
"[typescript]": {
10-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
11-
}
12-
}
2+
"files.encoding": "utf8",
3+
"files.eol": "\n",
4+
"files.insertFinalNewline": true,
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll.eslint": "always"
7+
},
8+
"editor.detectIndentation": false,
9+
"editor.formatOnSave": true,
10+
"editor.insertSpaces": true,
11+
"eslint.format.enable": true,
12+
"eslint.validate": [
13+
"javascript",
14+
"typescript",
15+
"json",
16+
"jsonc",
17+
"markdown",
18+
"yaml",
19+
"github-actions-workflow"
20+
],
21+
"[javascript]": {
22+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
23+
"editor.tabSize": 4
24+
},
25+
"[typescript]": {
26+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
27+
"editor.tabSize": 4
28+
},
29+
"[json]": {
30+
"editor.defaultFormatter": "vscode.json-language-features",
31+
"editor.tabSize": 2
32+
},
33+
"[jsonc]": {
34+
"editor.defaultFormatter": "vscode.json-language-features",
35+
"editor.tabSize": 2
36+
},
37+
"[markdown]": {
38+
"editor.tabSize": 2
39+
},
40+
"[yaml]": {
41+
"editor.tabSize": 2
42+
},
43+
"[github-actions-workflow]": {
44+
"editor.tabSize": 2
45+
}
46+
}

eslint.config.js

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,66 @@
1-
import eslint from '@eslint/js';
1+
import js from '@eslint/js';
2+
import json from '@eslint/json';
3+
import jsonc from 'eslint-plugin-jsonc';
4+
import markdown from '@eslint/markdown';
25
import stylistic from '@stylistic/eslint-plugin';
3-
import tseslint from 'typescript-eslint';
6+
import ts from 'typescript-eslint';
7+
import yml from 'eslint-plugin-yml';
48

5-
export default tseslint.config(
6-
eslint.configs.recommended,
7-
stylistic.configs.customize({
8-
arrowParens: false,
9-
blockSpacing: true,
10-
braceStyle: 'stroustrup',
11-
commaDangle: 'never',
12-
flat: true,
13-
indent: 4,
14-
jsx: false,
15-
quoteProps: 'consistent-as-needed',
16-
quotes: 'single',
17-
semi: true
18-
}),
19-
...tseslint.configs.strict,
20-
...tseslint.configs.stylistic,
9+
export default ts.config([
2110
{
22-
ignores: ['./dist']
11+
name: 'global-ignore',
12+
ignores: ['./dist', '**/package-lock.json']
13+
},
14+
{
15+
// https://github.com/eslint-stylistic/eslint-stylistic
16+
// https://github.com/typescript-eslint/typescript-eslint
17+
name: 'javascript-typescript',
18+
files: ['**/*.js', '**/*.ts'],
19+
extends: [
20+
js.configs.recommended,
21+
stylistic.configs.customize({
22+
arrowParens: false,
23+
blockSpacing: true,
24+
braceStyle: 'stroustrup',
25+
commaDangle: 'never',
26+
indent: 4,
27+
jsx: false,
28+
quoteProps: 'consistent-as-needed',
29+
quotes: 'single',
30+
semi: true,
31+
severity: 'error'
32+
}),
33+
ts.configs.strict,
34+
ts.configs.stylistic
35+
]
36+
},
37+
{
38+
// https://github.com/eslint/json
39+
// https://github.com/ota-meshi/eslint-plugin-jsonc
40+
name: 'json',
41+
files: ['**/*.json'],
42+
language: 'json/json',
43+
extends: [json.configs.recommended, jsonc.configs['flat/recommended-with-json']]
44+
},
45+
{
46+
// https://github.com/eslint/json
47+
// https://github.com/ota-meshi/eslint-plugin-jsonc
48+
name: 'jsonc',
49+
files: ['**/*.jsonc', './.vscode/*.json', '**/tsconfig.json'],
50+
language: 'json/jsonc',
51+
extends: [json.configs.recommended, jsonc.configs['flat/recommended-with-jsonc']]
52+
},
53+
{
54+
// https://github.com/eslint/markdown
55+
name: 'markdown',
56+
files: ['**/*.md'],
57+
language: 'markdown/gfm',
58+
extends: [markdown.configs.recommended]
59+
},
60+
{
61+
// https://github.com/ota-meshi/eslint-plugin-yml
62+
name: 'yml',
63+
files: ['**/*.yml', '**/*.yaml'],
64+
extends: [yml.configs['flat/recommended']]
2365
}
24-
);
66+
]);

0 commit comments

Comments
 (0)