Skip to content

Commit e46eaf8

Browse files
committed
update linter
1 parent 6e568c4 commit e46eaf8

20 files changed

+190
-148
lines changed

.eslintrc.js

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,67 @@ module.exports = {
88
ecmaVersion: 2020,
99
},
1010
extends: [
11-
"plugin:@mysticatea/es2015",
12-
"plugin:@mysticatea/+node",
13-
"plugin:@mysticatea/+eslint-plugin",
14-
'plugin:jsonc/recommended-with-jsonc',
15-
'plugin:jsonc/auto-config'
11+
"plugin:@ota-meshi/recommended",
12+
"plugin:@ota-meshi/+node",
13+
"plugin:@ota-meshi/+typescript",
14+
"plugin:@ota-meshi/+eslint-plugin",
15+
"plugin:@ota-meshi/+json",
16+
"plugin:@ota-meshi/+yaml",
17+
// "plugin:@ota-meshi/+md",
18+
"plugin:@ota-meshi/+prettier",
1619
],
1720
rules: {
1821
"require-jsdoc": "error",
1922
"no-warning-comments": "warn",
2023
"no-lonely-if": "off",
21-
"@mysticatea/ts/ban-ts-ignore": "off",
24+
"@typescript-eslint/no-non-null-assertion": "off",
2225
},
2326
overrides: [
2427
{
2528
files: ["*.ts"],
26-
rules: {
27-
// "@mysticatea/ts/no-require-imports": "off",
28-
// "@mysticatea/ts/no-var-requires": "off",
29-
"@mysticatea/node/no-missing-import": "off",
30-
"no-implicit-globals": "off",
31-
"@mysticatea/node/no-extraneous-import": "off",
32-
},
29+
parser: "@typescript-eslint/parser",
3330
parserOptions: {
3431
sourceType: "module",
3532
project: "./tsconfig.json",
3633
},
34+
rules: {
35+
"no-implicit-globals": "off",
36+
"@typescript-eslint/naming-convention": [
37+
"error",
38+
{
39+
selector: "default",
40+
format: ["camelCase"],
41+
leadingUnderscore: "allow",
42+
trailingUnderscore: "allow",
43+
},
44+
{
45+
selector: "variable",
46+
format: ["camelCase", "UPPER_CASE"],
47+
leadingUnderscore: "allow",
48+
trailingUnderscore: "allow",
49+
},
50+
{
51+
selector: "typeLike",
52+
format: ["PascalCase"],
53+
},
54+
{
55+
selector: "property",
56+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
57+
},
58+
{
59+
selector: "method",
60+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
61+
},
62+
],
63+
},
3764
},
3865
{
3966
files: ["lib/rules/**"],
4067
rules: {
41-
"@mysticatea/eslint-plugin/report-message-format": [
68+
"eslint-plugin/report-message-format": [
4269
"error",
4370
"[^a-z].*\\.$",
4471
],
45-
"@mysticatea/eslint-plugin/require-meta-docs-url": "off",
4672
},
4773
},
4874
{
@@ -54,6 +80,7 @@ module.exports = {
5480
},
5581
{
5682
files: ["*.vue"],
83+
extends: ["plugin:@ota-meshi/+vue2", "plugin:@ota-meshi/+prettier"],
5784
parserOptions: {
5885
sourceType: "module",
5986
},
@@ -66,21 +93,12 @@ module.exports = {
6693
parserOptions: {
6794
sourceType: "module",
6895
ecmaVersion: 2020,
69-
parser: "babel-eslint",
7096
},
7197
globals: {
7298
window: true,
7399
},
74100
rules: {
75101
"require-jsdoc": "off",
76-
"@mysticatea/vue/html-closing-bracket-newline": "off",
77-
"@mysticatea/vue/max-attributes-per-line": "off",
78-
"@mysticatea/vue/comma-dangle": "off",
79-
"@mysticatea/vue/html-indent": "off",
80-
"@mysticatea/vue/html-self-closing": "off",
81-
"@mysticatea/node/no-unsupported-features/es-syntax": "off",
82-
"@mysticatea/node/no-missing-import": "off",
83-
"@mysticatea/node/no-missing-require": "off",
84102
},
85103
},
86104
],

docs/.vuepress/components/components/EslintPluginEditor.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,25 +125,25 @@ export default {
125125
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions(
126126
{
127127
validate: false,
128-
}
128+
},
129129
)
130130
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions(
131131
{
132132
validate: false,
133-
}
133+
},
134134
)
135135
})
136136
editor.$watch("codeEditor", () => {
137137
if (editor.codeEditor) {
138138
editor.codeEditor.onDidChangeModelDecorations(() =>
139-
this.onDidChangeModelDecorations(editor.codeEditor)
139+
this.onDidChangeModelDecorations(editor.codeEditor),
140140
)
141141
}
142142
})
143143
editor.$watch("fixedCodeEditor", () => {
144144
if (editor.fixedCodeEditor) {
145145
editor.fixedCodeEditor.onDidChangeModelDecorations(() =>
146-
this.onDidChangeModelDecorations(editor.fixedCodeEditor)
146+
this.onDidChangeModelDecorations(editor.fixedCodeEditor),
147147
)
148148
}
149149
})

docs/.vuepress/components/components/RulesSettings.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
<input
1313
:checked="
1414
category.rules.every((rule) =>
15-
isErrorState(rule.ruleId)
15+
isErrorState(rule.ruleId),
1616
)
1717
"
1818
type="checkbox"
1919
:indeterminate.prop="
2020
!category.rules.every((rule) =>
21-
isErrorState(rule.ruleId)
21+
isErrorState(rule.ruleId),
2222
) &&
2323
!category.rules.every(
24-
(rule) => !isErrorState(rule.ruleId)
24+
(rule) => !isErrorState(rule.ruleId),
2525
)
2626
"
2727
@input="onAllClick(category, $event)"
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module.exports = {
2-
rules: {
3-
"@mysticatea/prettier": "off"
4-
}
5-
}
2+
rules: {
3+
"prettier/prettier": "off",
4+
"no-unused-expressions": "off",
5+
"regexp/no-dupe-characters-character-class": "off"
6+
},
7+
}

docs/.vuepress/components/demo/stylelint.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports = {
55
indentation: null,
66
"selector-max-empty-lines": null,
77
"selector-type-no-unknown": null,
8-
"block-no-empty": null
8+
"block-no-empty": null,
99
},
1010
}
11-

docs/.vuepress/components/eslint-code-block.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default {
5050
return nodes
5151
.map(
5252
(node) =>
53-
node.text || this.computeCodeFromSlot(node.children)
53+
node.text || this.computeCodeFromSlot(node.children),
5454
)
5555
.join("")
5656
},

docs/.vuepress/components/rules/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// eslint-disable-next-line eslint-comments/disable-enable-pair -- demo
2+
/* eslint-disable node/no-unsupported-features/es-syntax -- demo */
13
import * as coreRules from "../../../../node_modules/eslint4b/dist/core-rules"
24
import plugin from "../../../../"
35

@@ -58,7 +60,7 @@ for (const k of Object.keys(coreRules)) {
5860
}
5961

6062
allRules.sort((a, b) =>
61-
a.ruleId > b.ruleId ? 1 : a.ruleId < b.ruleId ? -1 : 0
63+
a.ruleId > b.ruleId ? 1 : a.ruleId < b.ruleId ? -1 : 0,
6264
)
6365

6466
export const categories = []
@@ -87,7 +89,7 @@ categories.sort((a, b) =>
8789
? 1
8890
: a.title < b.title
8991
? -1
90-
: 0
92+
: 0,
9193
)
9294

9395
export const DEFAULT_RULES_CONFIG = allRules.reduce((c, r) => {

docs/.vuepress/components/state/deserialize.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// eslint-disable-next-line eslint-comments/disable-enable-pair -- demo
2+
/* eslint-disable node/no-unsupported-features/es-syntax -- demo */
13
import pako from "../../../../node_modules/pako"
24

35
/**
@@ -36,6 +38,7 @@ export function deserializeState(serializedString) {
3638
}
3739
}
3840
} catch (error) {
41+
//eslint-disable-next-line no-console -- demo
3942
console.error(error)
4043
}
4144

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
// eslint-disable-next-line eslint-comments/disable-enable-pair -- demo
2+
/* eslint-disable node/no-unsupported-features/es-syntax -- demo */
13
export * from "./deserialize"
24
export * from "./serialize"

docs/.vuepress/components/state/serialize.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// eslint-disable-next-line eslint-comments/disable-enable-pair -- demo
2+
/* eslint-disable node/no-unsupported-features/es-syntax -- demo */
13
import pako from "../../../../node_modules/pako"
24

35
/**
@@ -30,12 +32,12 @@ export function serializeState(state) {
3032
(typeof window !== "undefined" && window.btoa(compressedString)) ||
3133
compressedString
3234

33-
//eslint-disable-next-line no-console
35+
//eslint-disable-next-line no-console -- demo
3436
console.log(
3537
`The compress rate of serialized string: ${(
3638
(100 * base64.length) /
3739
jsonString.length
38-
).toFixed(1)}% (${jsonString.length}B → ${base64.length}B)`
40+
).toFixed(1)}% (${jsonString.length}B → ${base64.length}B)`,
3941
)
4042

4143
return base64

0 commit comments

Comments
 (0)