Skip to content

Commit be5fca8

Browse files
committed
style: disable no-console and no-undef rules in eslint
This commit disables the 'no-console' and 'no-undef' ESLint rules to allow for more permissive logging and development practices. The change is reflected in the newly introduced eslint.config.mjs file.
1 parent 20321ce commit be5fca8

22 files changed

+10724
-4923
lines changed

.eslintrc.cjs

-6
This file was deleted.

.github/dependabot.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "npm" # See documentation for possible values
9-
directory: "/" # Location of package manifests
8+
- package-ecosystem: npm # See documentation for possible values
9+
directory: / # Location of package manifests
1010
schedule:
11-
interval: "weekly"
11+
interval: weekly

.vscode/extensions.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint"
4+
]
5+
}

.vscode/settings.json

+71-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,76 @@
11
{
2+
// Disable the default formatter, use eslint instead
3+
"prettier.enable": false,
4+
"editor.formatOnSave": false,
5+
// Auto fix
26
"editor.codeActionsOnSave": {
3-
"source.fixAll.eslint": "explicit"
7+
"source.fixAll.eslint": "explicit",
8+
"source.organizeImports": "never"
49
},
5-
// 配置 Tab 空格数
6-
"editor.tabSize": 2,
7-
// 保存自动格式化代码
8-
"editor.formatOnSave": true,
9-
"eslint.options": {
10-
"configFile": "./.eslintrc.cjs",
11-
"rules": {
12-
"no-restricted-syntax": "off",
13-
"guard-for-in": "off"
10+
// Silent the stylistic rules in you IDE, but still auto fix them
11+
"eslint.rules.customizations": [
12+
{
13+
"rule": "style/*",
14+
"severity": "off"
15+
},
16+
{
17+
"rule": "format/*",
18+
"severity": "off"
19+
},
20+
{
21+
"rule": "*-indent",
22+
"severity": "off"
23+
},
24+
{
25+
"rule": "*-spacing",
26+
"severity": "off"
27+
},
28+
{
29+
"rule": "*-spaces",
30+
"severity": "off"
31+
},
32+
{
33+
"rule": "*-order",
34+
"severity": "off"
35+
},
36+
{
37+
"rule": "*-dangle",
38+
"severity": "off"
39+
},
40+
{
41+
"rule": "*-newline",
42+
"severity": "off"
43+
},
44+
{
45+
"rule": "*quotes",
46+
"severity": "off"
47+
},
48+
{
49+
"rule": "*semi",
50+
"severity": "off"
1451
}
15-
},
16-
"eslint.validate": ["javascript", "html", "typescript"]
52+
],
53+
// Enable eslint for all supported languages
54+
"eslint.validate": [
55+
"javascript",
56+
"javascriptreact",
57+
"typescript",
58+
"typescriptreact",
59+
"vue",
60+
"html",
61+
"markdown",
62+
"json",
63+
"jsonc",
64+
"yaml",
65+
"toml",
66+
"xml",
67+
"gql",
68+
"graphql",
69+
"astro",
70+
"css",
71+
"less",
72+
"scss",
73+
"pcss",
74+
"postcss"
75+
]
1776
}

README.es-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ Adjust the component path to the packaged output path
7373
<my-component text="Made for cross-technology stack purposes!"></my-component>
7474
</body>
7575
```
76-
For detailed documentation, please visit: https://quark-ecosystem.github.io/quarkc-docs/#/en-US/docs/publishing
76+
For detailed documentation, please visit: https://quark-ecosystem.github.io/quarkc-docs/#/en-US/docs/publishing
+20-20
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import { expect, fixture } from "@open-wc/testing";
2-
import "../../../dist/MyComponent/index";
1+
import { expect, fixture } from '@open-wc/testing'
2+
import '../../../dist/MyComponent/index'
33

44
const data = {
5-
text: "HelloWorld",
5+
text: 'HelloWorld',
66
count: 1,
7-
};
7+
}
88

9-
let el;
9+
let el
1010

11-
describe("<my-component />", async () => {
12-
it("property text exist", async () => {
13-
el = await fixture(`<my-component text=${data.text}></my-component`);
14-
expect(el.text).to.equal(data.text);
15-
});
11+
describe('<my-component />', async () => {
12+
it('property text exist', async () => {
13+
el = await fixture(`<my-component text=${data.text}></my-component`)
14+
expect(el.text).to.equal(data.text)
15+
})
1616

17-
it("property count exist", async () => {
18-
el = await fixture(`<my-component count=${data.count}></my-component`);
19-
expect(el.count).to.equal(data.count);
20-
});
17+
it('property count exist', async () => {
18+
el = await fixture(`<my-component count=${data.count}></my-component`)
19+
expect(el.count).to.equal(data.count)
20+
})
2121

22-
it("property count changed", async () => {
23-
el = await fixture(`<my-component count=${data.count}></my-component`);
24-
el.add();
25-
expect(el.count).to.equal(data.count + 1);
26-
});
27-
});
22+
it('property count changed', async () => {
23+
el = await fixture(`<my-component count=${data.count}></my-component`)
24+
el.add()
25+
expect(el.count).to.equal(data.count + 1)
26+
})
27+
})

components/MyComponent/index.tsx

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import { QuarkElement, property, customElement } from "quarkc";
2-
import style from "./index.less?inline";
1+
import { QuarkElement, customElement, property } from 'quarkc'
2+
import style from './index.less?inline'
33

44
@customElement({
5-
tag: "my-component",
5+
tag: 'my-component',
66
style,
77
})
88
class MyComponent extends QuarkElement {
99
@property({ type: Number }) // 外部属性
10-
count = 0;
10+
count = 0
1111

1212
@property({ type: String })
13-
text = "";
13+
text = ''
1414

1515
add = () => {
1616
// 内部事件
17-
this.count += 1;
18-
};
17+
this.count += 1
18+
}
1919

2020
componentDidMount() {
2121
// 生命周期
22-
console.log("dom loaded!");
22+
console.log('dom loaded!')
2323
// ...
2424
}
2525

@@ -29,25 +29,31 @@ class MyComponent extends QuarkElement {
2929
<div>
3030
<a href="https://quarkc.hellobike.com" target="_blank">
3131
<img
32-
src="https://quark-design.hellobike.com/assets/quark-logo.f9a6a307.png"
32+
src="https://github.com/hellof2e/static/blob/main/quark-logo.png?raw=true"
3333
class="logo"
3434
alt="quark logo"
3535
/>
3636
</a>
3737
</div>
3838

39-
<h1>Quark - {this.text}</h1>
39+
<h1>
40+
Quark -
41+
{this.text}
42+
</h1>
4043

4144
<div className="card">
42-
<button onClick={this.add}>count is: {this.count}</button>
45+
<button onClick={this.add}>
46+
count is:
47+
{this.count}
48+
</button>
4349
</div>
4450
</>
45-
);
51+
)
4652
}
4753
}
4854

4955
declare global {
5056
interface HTMLElementTagNameMap {
51-
"my-component": MyComponent;
57+
'my-component': MyComponent
5258
}
5359
}

components/MyComponent/vite-env.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/// <reference types="vite/client" />
1+
/// <reference types="vite/client" />

eslint.config.mjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import antfu from '@antfu/eslint-config'
2+
3+
export default antfu({
4+
rules: {
5+
'no-console': 'off',
6+
'antfu/no-import-dist': 'off',
7+
'no-undef': 'off',
8+
},
9+
})

0 commit comments

Comments
 (0)