Skip to content

Commit 29a94f8

Browse files
authored
chore: use default prettier settings like eslint-plugin-svelte (#177)
1 parent 5064bfa commit 29a94f8

39 files changed

+5678
-5772
lines changed

.eslintrc.js

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,81 @@
1-
"use strict"
1+
"use strict";
22

33
// const version = require("./package.json").version
44

55
module.exports = {
6-
parserOptions: {
7-
sourceType: "script",
8-
ecmaVersion: "latest",
9-
},
10-
extends: [
11-
"plugin:@ota-meshi/recommended",
12-
"plugin:@ota-meshi/+node",
13-
"plugin:@ota-meshi/+typescript",
14-
"plugin:@ota-meshi/+prettier",
15-
"plugin:@ota-meshi/+package-json",
16-
"plugin:@ota-meshi/+json",
6+
parserOptions: {
7+
sourceType: "script",
8+
ecmaVersion: "latest",
9+
},
10+
extends: [
11+
"plugin:@ota-meshi/recommended",
12+
"plugin:@ota-meshi/+node",
13+
"plugin:@ota-meshi/+typescript",
14+
"plugin:@ota-meshi/+prettier",
15+
"plugin:@ota-meshi/+package-json",
16+
"plugin:@ota-meshi/+json",
17+
],
18+
rules: {
19+
"no-lonely-if": "off",
20+
"no-shadow": "off",
21+
"no-warning-comments": "warn",
22+
"require-jsdoc": "error",
23+
"prettier/prettier": [
24+
"error",
25+
{},
26+
{
27+
usePrettierrc: true,
28+
},
1729
],
18-
rules: {
19-
"prettier/prettier": [
20-
"error",
21-
{
22-
usePrettierrc: true,
23-
},
30+
},
31+
overrides: [
32+
{
33+
files: ["*.ts"],
34+
parser: "@typescript-eslint/parser",
35+
parserOptions: {
36+
sourceType: "module",
37+
project: "./tsconfig.json",
38+
},
39+
rules: {
40+
"@typescript-eslint/naming-convention": [
41+
"error",
42+
{
43+
selector: "default",
44+
format: ["camelCase"],
45+
leadingUnderscore: "allow",
46+
trailingUnderscore: "allow",
47+
},
48+
{
49+
selector: "variable",
50+
format: ["camelCase", "UPPER_CASE"],
51+
leadingUnderscore: "allow",
52+
trailingUnderscore: "allow",
53+
},
54+
{
55+
selector: "typeLike",
56+
format: ["PascalCase"],
57+
},
58+
{
59+
selector: "property",
60+
format: null,
61+
},
62+
{
63+
selector: "method",
64+
format: null,
65+
},
2466
],
25-
"require-jsdoc": "error",
26-
"no-warning-comments": "warn",
27-
"no-lonely-if": "off",
28-
"no-shadow": "off",
67+
"@typescript-eslint/no-non-null-assertion": "off",
68+
"@typescript-eslint/no-use-before-define": "off",
69+
"@typescript-eslint/no-explicit-any": "off",
70+
"no-implicit-globals": "off",
71+
},
2972
},
30-
overrides: [
31-
{
32-
files: ["*.ts"],
33-
parser: "@typescript-eslint/parser",
34-
parserOptions: {
35-
sourceType: "module",
36-
project: "./tsconfig.json",
37-
},
38-
rules: {
39-
"@typescript-eslint/naming-convention": [
40-
"error",
41-
{
42-
selector: "default",
43-
format: ["camelCase"],
44-
leadingUnderscore: "allow",
45-
trailingUnderscore: "allow",
46-
},
47-
{
48-
selector: "variable",
49-
format: ["camelCase", "UPPER_CASE"],
50-
leadingUnderscore: "allow",
51-
trailingUnderscore: "allow",
52-
},
53-
{
54-
selector: "typeLike",
55-
format: ["PascalCase"],
56-
},
57-
{
58-
selector: "property",
59-
format: null,
60-
},
61-
{
62-
selector: "method",
63-
format: null,
64-
},
65-
],
66-
"@typescript-eslint/no-non-null-assertion": "off",
67-
"@typescript-eslint/no-use-before-define": "off",
68-
"@typescript-eslint/no-explicit-any": "off",
69-
"no-implicit-globals": "off",
70-
},
71-
},
72-
{
73-
files: ["scripts/**/*.ts", "tests/**/*.ts"],
74-
rules: {
75-
"no-console": "off",
76-
"require-jsdoc": "off",
77-
},
78-
},
79-
],
80-
}
73+
{
74+
files: ["scripts/**/*.ts", "tests/**/*.ts"],
75+
rules: {
76+
"no-console": "off",
77+
"require-jsdoc": "off",
78+
},
79+
},
80+
],
81+
};

.prettierrc.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

benchmark/index.ts

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
11
// eslint-disable-next-line eslint-comments/disable-enable-pair -- ignore
22
/* eslint-disable require-jsdoc, no-console -- ignore */
3-
import * as Benchmark from "benchmark"
4-
import fs from "fs"
5-
import { parseForESLint } from "../src/index"
6-
import { parseForESLint as parseOld } from "../node_modules/svelte-eslint-parser"
3+
import * as Benchmark from "benchmark";
4+
import fs from "fs";
5+
import { parseForESLint } from "../src/index";
6+
import { parseForESLint as parseOld } from "../node_modules/svelte-eslint-parser";
77

88
const contents = `${fs.readFileSync(
9-
require.resolve("../explorer-v2/src/lib/RulesSettings.svelte"),
10-
"utf-8",
11-
)}// comments`
9+
require.resolve("../explorer-v2/src/lib/RulesSettings.svelte"),
10+
"utf-8"
11+
)}// comments`;
1212

13-
type Result = { name: string; hz: number }
14-
const results: Result[] = []
13+
type Result = { name: string; hz: number };
14+
const results: Result[] = [];
1515

1616
function format(hz: number): string {
17-
return (~~(hz * 100) / 100).toString().padEnd(4, " ").padStart(6, " ")
17+
return (~~(hz * 100) / 100).toString().padEnd(4, " ").padStart(6, " ");
1818
}
1919

2020
function onCycle(event: { target: Result }): void {
21-
const { name, hz } = event.target
22-
results.push({ name, hz })
21+
const { name, hz } = event.target;
22+
results.push({ name, hz });
2323

24-
console.log(event.target.toString())
24+
console.log(event.target.toString());
2525
}
2626

2727
function onComplete(): void {
28-
console.log("-".repeat(72))
29-
const map: Record<string, number[]> = {}
30-
for (const result of results) {
31-
const r = (map[result.name.slice(2)] ??= [])
32-
r.push(result.hz)
33-
}
34-
for (const name of Object.keys(map)) {
35-
console.log(
36-
`${name.padEnd(15)} ${format(
37-
map[name].reduce((p, a) => p + a, 0) / map[name].length,
38-
)} ops/sec`,
39-
)
40-
}
41-
for (let i = 0; i < results.length; ++i) {
42-
const result = results[i]
28+
console.log("-".repeat(72));
29+
const map: Record<string, number[]> = {};
30+
for (const result of results) {
31+
const r = (map[result.name.slice(2)] ??= []);
32+
r.push(result.hz);
33+
}
34+
for (const name of Object.keys(map)) {
35+
console.log(
36+
`${name.padEnd(15)} ${format(
37+
map[name].reduce((p, a) => p + a, 0) / map[name].length
38+
)} ops/sec`
39+
);
40+
}
41+
for (let i = 0; i < results.length; ++i) {
42+
const result = results[i];
4343

44-
console.log(`${result.name.padEnd(15)} ${format(result.hz)} ops/sec`)
45-
}
44+
console.log(`${result.name.padEnd(15)} ${format(result.hz)} ops/sec`);
45+
}
4646
}
4747

48-
const suite = new Benchmark.Suite("benchmark", { onCycle, onComplete })
48+
const suite = new Benchmark.Suite("benchmark", { onCycle, onComplete });
4949

5050
for (const no of [1, 2, 3]) {
51-
suite.add(`${no} new svelte-eslint-parser`, function () {
52-
parseForESLint(contents, {
53-
loc: true,
54-
range: true,
55-
raw: true,
56-
tokens: true,
57-
comment: true,
58-
eslintVisitorKeys: true,
59-
eslintScopeManager: true,
60-
})
61-
})
62-
suite.add(`${no} old svelte-eslint-parser`, function () {
63-
parseOld(contents, {
64-
loc: true,
65-
range: true,
66-
raw: true,
67-
tokens: true,
68-
comment: true,
69-
eslintVisitorKeys: true,
70-
eslintScopeManager: true,
71-
})
72-
})
51+
suite.add(`${no} new svelte-eslint-parser`, function () {
52+
parseForESLint(contents, {
53+
loc: true,
54+
range: true,
55+
raw: true,
56+
tokens: true,
57+
comment: true,
58+
eslintVisitorKeys: true,
59+
eslintScopeManager: true,
60+
});
61+
});
62+
suite.add(`${no} old svelte-eslint-parser`, function () {
63+
parseOld(contents, {
64+
loc: true,
65+
range: true,
66+
raw: true,
67+
tokens: true,
68+
comment: true,
69+
eslintVisitorKeys: true,
70+
eslintScopeManager: true,
71+
});
72+
});
7373
}
7474

75-
suite.run()
75+
suite.run();

renovate.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"extends": [
3-
"config:base",
4-
":preserveSemverRanges",
5-
":disableDependencyDashboard"
6-
],
7-
"packageRules": [
8-
{
9-
"updateTypes": ["minor", "patch", "pin", "digest"],
10-
"automerge": true
11-
},
12-
{
13-
"depTypeList": ["devDependencies"],
14-
"automerge": true
15-
}
16-
]
2+
"extends": [
3+
"config:base",
4+
":preserveSemverRanges",
5+
":disableDependencyDashboard"
6+
],
7+
"packageRules": [
8+
{
9+
"updateTypes": ["minor", "patch", "pin", "digest"],
10+
"automerge": true
11+
},
12+
{
13+
"depTypeList": ["devDependencies"],
14+
"automerge": true
15+
}
16+
]
1717
}

0 commit comments

Comments
 (0)