@curev/eslint-config 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.github/workflows/release.yml +37 -0
- package/.vscode/settings.json +36 -0
- package/CHANGELOG.md +740 -0
- package/README.md +70 -0
- package/eslint.config.ts +3 -0
- package/fixtures/input/css.css +10 -0
- package/fixtures/input/html.html +17 -0
- package/fixtures/input/javascript.js +69 -0
- package/fixtures/input/jsx.jsx +27 -0
- package/fixtures/input/markdown.md +34 -0
- package/fixtures/input/svelte.svelte +8 -0
- package/fixtures/input/toml.toml +23 -0
- package/fixtures/input/tsx.tsx +32 -0
- package/fixtures/input/typescript.ts +84 -0
- package/fixtures/input/vue-ts.vue +35 -0
- package/fixtures/input/vue.vue +27 -0
- package/fixtures/output/all/javascript.js +72 -0
- package/fixtures/output/all/jsx.jsx +26 -0
- package/fixtures/output/all/markdown.md +33 -0
- package/fixtures/output/all/svelte.svelte +8 -0
- package/fixtures/output/all/toml.toml +23 -0
- package/fixtures/output/all/tsx.tsx +32 -0
- package/fixtures/output/all/typescript.ts +83 -0
- package/fixtures/output/all/vue-ts.vue +35 -0
- package/fixtures/output/all/vue.vue +24 -0
- package/fixtures/output/js/javascript.js +72 -0
- package/fixtures/output/js/markdown.md +33 -0
- package/fixtures/output/js/toml.toml +23 -0
- package/fixtures/output/no-markdown-with-formatters/javascript.js +72 -0
- package/fixtures/output/no-markdown-with-formatters/jsx.jsx +24 -0
- package/fixtures/output/no-markdown-with-formatters/markdown.md +33 -0
- package/fixtures/output/no-markdown-with-formatters/toml.toml +23 -0
- package/fixtures/output/no-markdown-with-formatters/tsx.tsx +23 -0
- package/fixtures/output/no-markdown-with-formatters/typescript.ts +83 -0
- package/fixtures/output/no-style/javascript.js +72 -0
- package/fixtures/output/no-style/jsx.jsx +21 -0
- package/fixtures/output/no-style/toml.toml +23 -0
- package/fixtures/output/no-style/typescript.ts +80 -0
- package/fixtures/output/no-style/vue-ts.vue +35 -0
- package/fixtures/output/no-style/vue.vue +24 -0
- package/fixtures/output/tab-double-quotes/javascript.js +72 -0
- package/fixtures/output/tab-double-quotes/jsx.jsx +26 -0
- package/fixtures/output/tab-double-quotes/markdown.md +33 -0
- package/fixtures/output/tab-double-quotes/toml.toml +23 -0
- package/fixtures/output/tab-double-quotes/tsx.tsx +32 -0
- package/fixtures/output/tab-double-quotes/typescript.ts +83 -0
- package/fixtures/output/tab-double-quotes/vue-ts.vue +35 -0
- package/fixtures/output/tab-double-quotes/vue.vue +24 -0
- package/fixtures/output/ts-override/javascript.js +72 -0
- package/fixtures/output/ts-override/jsx.jsx +26 -0
- package/fixtures/output/ts-override/markdown.md +33 -0
- package/fixtures/output/ts-override/toml.toml +23 -0
- package/fixtures/output/ts-override/tsx.tsx +32 -0
- package/fixtures/output/ts-override/typescript.ts +83 -0
- package/fixtures/output/ts-override/vue-ts.vue +35 -0
- package/fixtures/output/ts-override/vue.vue +24 -0
- package/fixtures/output/with-formatters/css.css +11 -0
- package/fixtures/output/with-formatters/html.html +28 -0
- package/fixtures/output/with-formatters/javascript.js +72 -0
- package/fixtures/output/with-formatters/jsx.jsx +26 -0
- package/fixtures/output/with-formatters/markdown.md +34 -0
- package/fixtures/output/with-formatters/toml.toml +23 -0
- package/fixtures/output/with-formatters/tsx.tsx +32 -0
- package/fixtures/output/with-formatters/typescript.ts +83 -0
- package/fixtures/output/with-formatters/vue-ts.vue +38 -0
- package/fixtures/output/with-formatters/vue.vue +24 -0
- package/package.json +130 -12
- package/src/configs/comments.ts +19 -0
- package/src/configs/formatters.ts +187 -0
- package/src/configs/ignores.ts +10 -0
- package/src/configs/imports.ts +46 -0
- package/src/configs/index.ts +21 -0
- package/src/configs/javascript.ts +277 -0
- package/src/configs/jsdoc.ts +41 -0
- package/src/configs/jsonc.ts +86 -0
- package/src/configs/markdown.ts +110 -0
- package/src/configs/node.ts +24 -0
- package/src/configs/perfectionist.ts +18 -0
- package/src/configs/react.ts +111 -0
- package/src/configs/sort.ts +223 -0
- package/src/configs/stylistic.ts +52 -0
- package/src/configs/svelte.ts +107 -0
- package/src/configs/test.ts +54 -0
- package/src/configs/toml.ts +72 -0
- package/src/configs/typescript.ts +171 -0
- package/src/configs/unicorn.ts +41 -0
- package/src/configs/unocss.ts +43 -0
- package/src/configs/vue.ts +170 -0
- package/src/configs/yaml.ts +72 -0
- package/src/factory.ts +255 -0
- package/src/globs.ts +81 -0
- package/src/index.ts +9 -0
- package/src/plugins.ts +10 -0
- package/src/stub.d.ts +3 -0
- package/src/types.ts +364 -0
- package/src/utils.ts +76 -0
- package/src/vender/prettier-types.ts +136 -0
- package/test/cli.spec.ts +90 -0
- package/test/fixtures.test.ts +127 -0
- package/tsconfig.json +17 -0
- package/tsup.config.ts +8 -0
- package/index.js +0 -5
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Define a TypeScript interface
|
|
2
|
+
type Person = {
|
|
3
|
+
name: string
|
|
4
|
+
age: number
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Create an array of objects with the defined interface
|
|
8
|
+
const people: Person[] = [
|
|
9
|
+
{ name: 'Alice', age: 30 },
|
|
10
|
+
{ name: 'Bob', age: 25 },
|
|
11
|
+
{ name: 'Charlie', age: 35 },
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
const log = console.log
|
|
16
|
+
|
|
17
|
+
// Use a for...of loop to iterate over the array
|
|
18
|
+
for (const person of people)
|
|
19
|
+
log(`Hello, my name is ${person.name} and I am ${person.age} years old.`)
|
|
20
|
+
|
|
21
|
+
// Define a generic function
|
|
22
|
+
function identity< T >(arg: T): T {
|
|
23
|
+
return arg
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Use the generic function with type inference
|
|
27
|
+
const result = identity(
|
|
28
|
+
'TypeScript is awesome',
|
|
29
|
+
)
|
|
30
|
+
log(result)
|
|
31
|
+
|
|
32
|
+
// Use optional properties in an interface
|
|
33
|
+
type Car = {
|
|
34
|
+
make: string
|
|
35
|
+
model?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Create objects using the interface
|
|
39
|
+
const car1: Car = { make: 'Toyota' }
|
|
40
|
+
const car2: Car = {
|
|
41
|
+
make: 'Ford',
|
|
42
|
+
model: 'Focus',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Use union types
|
|
46
|
+
type Fruit = 'apple' | 'banana' | 'orange'
|
|
47
|
+
const favoriteFruit: Fruit = 'apple'
|
|
48
|
+
|
|
49
|
+
// Use a type assertion to tell TypeScript about the type
|
|
50
|
+
const inputValue: any = '42'
|
|
51
|
+
const numericValue = inputValue as number
|
|
52
|
+
|
|
53
|
+
// Define a class with access modifiers
|
|
54
|
+
class Animal {
|
|
55
|
+
private name: string
|
|
56
|
+
constructor(name: string) {
|
|
57
|
+
this.name = name
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
protected makeSound(sound: string) {
|
|
61
|
+
log(`${this.name} says ${sound}`)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Extend a class
|
|
66
|
+
class Dog extends Animal {
|
|
67
|
+
constructor(private alias: string) {
|
|
68
|
+
super(alias)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
bark() {
|
|
72
|
+
this.makeSound('Woof!')
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const dog = new Dog('Buddy')
|
|
77
|
+
dog.bark()
|
|
78
|
+
|
|
79
|
+
function fn(): string {
|
|
80
|
+
return `hello${1}`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
log(car1, car2, favoriteFruit, numericValue, fn())
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Define reactive data and props
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
const greeting = ref('Hello, Vue 3!')
|
|
6
|
+
const counter = ref<number | string>(0)
|
|
7
|
+
|
|
8
|
+
// Define a function
|
|
9
|
+
function incrementCounter() {
|
|
10
|
+
counter.value++
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
<h1>{{ greeting }}</h1>
|
|
17
|
+
<button @click="incrementCounter">
|
|
18
|
+
Click me!
|
|
19
|
+
</button>
|
|
20
|
+
<p>Counter: {{ counter }}</p>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
.a { color: red }
|
|
26
|
+
</style>
|
|
27
|
+
|
|
28
|
+
<style lang="scss">
|
|
29
|
+
$font-stack: Helvetica, sans-serif;
|
|
30
|
+
$primary-color: #333;
|
|
31
|
+
|
|
32
|
+
body { font: 100% $font-stack;
|
|
33
|
+
color: $primary-color;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
// Define reactive data and props
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
const greeting = ref(`Hello, Vue 3!${1}`)
|
|
6
|
+
const counter = ref(0)
|
|
7
|
+
|
|
8
|
+
// Define a function
|
|
9
|
+
function incrementCounter() {
|
|
10
|
+
counter.value++
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
<h1>
|
|
17
|
+
{{ greeting }}
|
|
18
|
+
</h1>
|
|
19
|
+
<button @click="incrementCounter">
|
|
20
|
+
Click me!
|
|
21
|
+
</button>
|
|
22
|
+
<p>Counter: {{ counter }}</p>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="no-js mY-ClAsS">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>My tITlE</title>
|
|
6
|
+
<meta name="description" content="My CoNtEnT" />
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<p>
|
|
10
|
+
Hello world!<br />
|
|
11
|
+
This is HTML5 Boilerplate.
|
|
12
|
+
</p>
|
|
13
|
+
<script>
|
|
14
|
+
window.ga = function () {
|
|
15
|
+
ga.q.push(arguments)
|
|
16
|
+
}
|
|
17
|
+
ga.q = []
|
|
18
|
+
ga.l = +new Date()
|
|
19
|
+
ga('create', 'UA-XXXXX-Y', 'auto')
|
|
20
|
+
ga('send', 'pageview')
|
|
21
|
+
</script>
|
|
22
|
+
<script
|
|
23
|
+
src="https://www.google-analytics.com/analytics.js"
|
|
24
|
+
async
|
|
25
|
+
defer
|
|
26
|
+
></script>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// This file is generated by ChatGPT
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line no-console
|
|
4
|
+
const log = console.log
|
|
5
|
+
|
|
6
|
+
// Define a class using ES6 class syntax
|
|
7
|
+
class Person {
|
|
8
|
+
constructor(name, age) {
|
|
9
|
+
this.name = name
|
|
10
|
+
this.age = age
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Define a method within the class
|
|
14
|
+
sayHello() {
|
|
15
|
+
log(`Hello, my name is ${this.name} and I am ${this.age} years old.`)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Create an array of objects
|
|
20
|
+
const people = [
|
|
21
|
+
new Person('Alice', 30),
|
|
22
|
+
new Person('Bob', 25),
|
|
23
|
+
new Person('Charlie', 35),
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
// Use the forEach method to iterate over the array
|
|
27
|
+
people.forEach((person) => {
|
|
28
|
+
person.sayHello()
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Use a template literal to create a multiline string
|
|
32
|
+
const multilineString = `
|
|
33
|
+
This is a multiline string
|
|
34
|
+
that spans multiple lines.
|
|
35
|
+
`
|
|
36
|
+
|
|
37
|
+
// Use destructuring assignment to extract values from an object
|
|
38
|
+
const { name, age } = people[0]
|
|
39
|
+
log(`First person in the array is ${name} and they are ${age} years old.`, multilineString)
|
|
40
|
+
|
|
41
|
+
// Use the spread operator to create a new array
|
|
42
|
+
const numbers = [1, 2, 3]
|
|
43
|
+
const newNumbers = [...numbers, 4, 5]
|
|
44
|
+
log(newNumbers)
|
|
45
|
+
|
|
46
|
+
// Use a try-catch block for error handling
|
|
47
|
+
try {
|
|
48
|
+
// Attempt to parse an invalid JSON string
|
|
49
|
+
JSON.parse('invalid JSON')
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error('Error parsing JSON:', error.message)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Use a ternary conditional operator
|
|
56
|
+
const isEven = num => num % 2 === 0
|
|
57
|
+
const number = 7
|
|
58
|
+
log(`${number} is ${isEven(number) ? 'even' : 'odd'}.`)
|
|
59
|
+
|
|
60
|
+
// Use a callback function with setTimeout for asynchronous code
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
log('This code runs after a delay of 2 seconds.')
|
|
63
|
+
}, 2000)
|
|
64
|
+
|
|
65
|
+
let a, b, c, d, foo
|
|
66
|
+
|
|
67
|
+
if (a
|
|
68
|
+
|| b
|
|
69
|
+
|| c || d
|
|
70
|
+
|| (d && b)
|
|
71
|
+
)
|
|
72
|
+
foo()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function HelloWorld({
|
|
2
|
+
greeting = 'hello',
|
|
3
|
+
greeted = '"World"',
|
|
4
|
+
silent = false,
|
|
5
|
+
onMouseOver,
|
|
6
|
+
}) {
|
|
7
|
+
if (!greeting)
|
|
8
|
+
return null
|
|
9
|
+
|
|
10
|
+
// TODO: Don't use random in render
|
|
11
|
+
const num = Math.floor (Math.random() * 1e+7).toString()
|
|
12
|
+
.replace(/\.\d+/ig, '')
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="HelloWorld" title={`You are visitor number ${num}`} onMouseOver={onMouseOver}>
|
|
16
|
+
<strong>{ greeting.slice(0, 1).toUpperCase() + greeting.slice(1).toLowerCase() }</strong>
|
|
17
|
+
{greeting.endsWith(',')
|
|
18
|
+
? ' '
|
|
19
|
+
: <span style={{ color: '\grey' }}>", "</span> }
|
|
20
|
+
<em>
|
|
21
|
+
{ greeted }
|
|
22
|
+
</em>
|
|
23
|
+
{ (silent) ? '.' : '!'}
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Header
|
|
2
|
+
|
|
3
|
+
_Look,_ code blocks are formatted _too!_
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
// This should be handled by ESLint instead of Prettier
|
|
7
|
+
function identity(x) {
|
|
8
|
+
if (foo)
|
|
9
|
+
console.log('bar')
|
|
10
|
+
}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
/* This should be handled by Prettier */
|
|
15
|
+
.foo {
|
|
16
|
+
color: red;
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
| Pilot | Airport | Hours |
|
|
21
|
+
| -------- | :-----: | ----: |
|
|
22
|
+
| John Doe | SKG | 1338 |
|
|
23
|
+
| Jane Roe | JFK | 314 |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
- List
|
|
28
|
+
- with a [link] (/to/somewhere)
|
|
29
|
+
- and [another one]
|
|
30
|
+
|
|
31
|
+
[another one]: http://example.com 'Example title'
|
|
32
|
+
|
|
33
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
34
|
+
Curabitur consectetur maximus risus, sed maximus tellus tincidunt et.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
comma = [
|
|
2
|
+
1,
|
|
3
|
+
2,
|
|
4
|
+
3,
|
|
5
|
+
]
|
|
6
|
+
|
|
7
|
+
[foo]
|
|
8
|
+
b = 1
|
|
9
|
+
c = "hello"
|
|
10
|
+
a = { answer = 42 }
|
|
11
|
+
indent = [
|
|
12
|
+
1,
|
|
13
|
+
2
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[a-table]
|
|
17
|
+
apple.type = "fruit"
|
|
18
|
+
apple.skin = "thin"
|
|
19
|
+
apple.color = "red"
|
|
20
|
+
|
|
21
|
+
orange.type = "fruit"
|
|
22
|
+
orange.skin = "thick"
|
|
23
|
+
orange.color = "orange"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function Component1() {
|
|
2
|
+
return <div />
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function jsx2() {
|
|
6
|
+
const props = { a: 1, b: 2 }
|
|
7
|
+
return (
|
|
8
|
+
<a foo="bar" bar="foo">
|
|
9
|
+
<div
|
|
10
|
+
{...props}
|
|
11
|
+
a={1}
|
|
12
|
+
b="2"
|
|
13
|
+
>
|
|
14
|
+
Inline Text
|
|
15
|
+
</div>
|
|
16
|
+
<Component1>
|
|
17
|
+
Block Text
|
|
18
|
+
</Component1>
|
|
19
|
+
<div>
|
|
20
|
+
Mixed
|
|
21
|
+
<div>Foo</div>
|
|
22
|
+
Text
|
|
23
|
+
<b> Bar</b>
|
|
24
|
+
</div>
|
|
25
|
+
<p>
|
|
26
|
+
foo
|
|
27
|
+
<i>bar</i>
|
|
28
|
+
<b>baz</b>
|
|
29
|
+
</p>
|
|
30
|
+
</a>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Define a TypeScript interface
|
|
2
|
+
interface Person {
|
|
3
|
+
name: string
|
|
4
|
+
age: number
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Create an array of objects with the defined interface
|
|
8
|
+
const people: Person[] = [
|
|
9
|
+
{ name: 'Alice', age: 30 },
|
|
10
|
+
{ name: 'Bob', age: 25 },
|
|
11
|
+
{ name: 'Charlie', age: 35 },
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
const log = console.log
|
|
16
|
+
|
|
17
|
+
// Use a for...of loop to iterate over the array
|
|
18
|
+
for (const person of people)
|
|
19
|
+
log(`Hello, my name is ${person.name} and I am ${person.age} years old.`)
|
|
20
|
+
|
|
21
|
+
// Define a generic function
|
|
22
|
+
function identity< T >(arg: T): T {
|
|
23
|
+
return arg
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Use the generic function with type inference
|
|
27
|
+
const result = identity(
|
|
28
|
+
'TypeScript is awesome',
|
|
29
|
+
)
|
|
30
|
+
log(result)
|
|
31
|
+
|
|
32
|
+
// Use optional properties in an interface
|
|
33
|
+
interface Car {
|
|
34
|
+
make: string
|
|
35
|
+
model?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Create objects using the interface
|
|
39
|
+
const car1: Car = { make: 'Toyota' }
|
|
40
|
+
const car2: Car = {
|
|
41
|
+
make: 'Ford',
|
|
42
|
+
model: 'Focus',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Use union types
|
|
46
|
+
type Fruit = 'apple' | 'banana' | 'orange'
|
|
47
|
+
const favoriteFruit: Fruit = 'apple'
|
|
48
|
+
|
|
49
|
+
// Use a type assertion to tell TypeScript about the type
|
|
50
|
+
const inputValue: any = '42'
|
|
51
|
+
const numericValue = inputValue as number
|
|
52
|
+
|
|
53
|
+
// Define a class with access modifiers
|
|
54
|
+
class Animal {
|
|
55
|
+
private name: string
|
|
56
|
+
constructor(name: string) {
|
|
57
|
+
this.name = name
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
protected makeSound(sound: string) {
|
|
61
|
+
log(`${this.name} says ${sound}`)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Extend a class
|
|
66
|
+
class Dog extends Animal {
|
|
67
|
+
constructor(private alias: string) {
|
|
68
|
+
super(alias)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
bark() {
|
|
72
|
+
this.makeSound('Woof!')
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const dog = new Dog('Buddy')
|
|
77
|
+
dog.bark()
|
|
78
|
+
|
|
79
|
+
function fn(): string {
|
|
80
|
+
return `hello${1}`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
log(car1, car2, favoriteFruit, numericValue, fn())
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Define reactive data and props
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
const greeting = ref('Hello, Vue 3!')
|
|
6
|
+
const counter = ref<number | string>(0)
|
|
7
|
+
|
|
8
|
+
// Define a function
|
|
9
|
+
function incrementCounter() {
|
|
10
|
+
counter.value++
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
<h1>{{ greeting }}</h1>
|
|
17
|
+
<button @click="incrementCounter">
|
|
18
|
+
Click me!
|
|
19
|
+
</button>
|
|
20
|
+
<p>Counter: {{ counter }}</p>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
.a {
|
|
26
|
+
color: red;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
|
|
30
|
+
<style lang="scss">
|
|
31
|
+
$font-stack: Helvetica, sans-serif;
|
|
32
|
+
$primary-color: #333;
|
|
33
|
+
|
|
34
|
+
body {
|
|
35
|
+
font: 100% $font-stack;
|
|
36
|
+
color: $primary-color;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
// Define reactive data and props
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
const greeting = ref(`Hello, Vue 3!${1}`)
|
|
6
|
+
const counter = ref(0)
|
|
7
|
+
|
|
8
|
+
// Define a function
|
|
9
|
+
function incrementCounter() {
|
|
10
|
+
counter.value++
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
<h1>
|
|
17
|
+
{{ greeting }}
|
|
18
|
+
</h1>
|
|
19
|
+
<button @click="incrementCounter">
|
|
20
|
+
Click me!
|
|
21
|
+
</button>
|
|
22
|
+
<p>Counter: {{ counter }}</p>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
package/package.json
CHANGED
|
@@ -1,21 +1,139 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curev/eslint-config",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"packageManager": "pnpm@8.6.9",
|
|
5
6
|
"author": "Chizuki<chizukicn@outlook.com> (https://github.com/chizukicn/)",
|
|
6
7
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://github.com/
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
"homepage": "https://github.com/curev/eslint-config",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
15
18
|
"peerDependencies": {
|
|
16
|
-
"eslint": ">=
|
|
19
|
+
"@unocss/eslint-plugin": ">=0.50.0",
|
|
20
|
+
"eslint": ">=8.40.0",
|
|
21
|
+
"eslint-plugin-format": ">=0.1.0",
|
|
22
|
+
"eslint-plugin-react": "^7.33.2",
|
|
23
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
24
|
+
"eslint-plugin-react-refresh": "^0.4.4",
|
|
25
|
+
"eslint-plugin-svelte": "^2.34.1",
|
|
26
|
+
"svelte-eslint-parser": "^0.33.1"
|
|
27
|
+
},
|
|
28
|
+
"peerDependenciesMeta": {
|
|
29
|
+
"@unocss/eslint-plugin": {
|
|
30
|
+
"optional": true
|
|
31
|
+
},
|
|
32
|
+
"eslint-plugin-format": {
|
|
33
|
+
"optional": true
|
|
34
|
+
},
|
|
35
|
+
"eslint-plugin-react": {
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
"eslint-plugin-react-hooks": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
41
|
+
"eslint-plugin-react-refresh": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"eslint-plugin-svelte": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"svelte-eslint-parser": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
17
50
|
},
|
|
18
51
|
"dependencies": {
|
|
19
|
-
"@
|
|
52
|
+
"@antfu/eslint-define-config": "^1.23.0-2",
|
|
53
|
+
"@antfu/install-pkg": "^0.3.1",
|
|
54
|
+
"@eslint-types/jsdoc": "46.8.2-1",
|
|
55
|
+
"@eslint-types/typescript-eslint": "^6.18.1",
|
|
56
|
+
"@eslint-types/unicorn": "^50.0.1",
|
|
57
|
+
"@stylistic/eslint-plugin": "^1.5.4",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
59
|
+
"eslint-config-flat-gitignore": "^0.1.2",
|
|
60
|
+
"eslint-define-config": "^2.1.0",
|
|
61
|
+
"eslint-merge-processors": "^0.1.0",
|
|
62
|
+
"eslint-plugin-antfu": "^2.1.1",
|
|
63
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
64
|
+
"eslint-plugin-i": "^2.29.1",
|
|
65
|
+
"eslint-plugin-jsdoc": "^48.0.2",
|
|
66
|
+
"eslint-plugin-jsonc": "^2.12.2",
|
|
67
|
+
"eslint-plugin-markdown": "^3.0.1",
|
|
68
|
+
"eslint-plugin-n": "^16.6.2",
|
|
69
|
+
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
70
|
+
"eslint-plugin-perfectionist": "^2.5.0",
|
|
71
|
+
"eslint-plugin-toml": "^0.9.2",
|
|
72
|
+
"eslint-plugin-unicorn": "^50.0.1",
|
|
73
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
74
|
+
"eslint-plugin-vitest": "^0.3.20",
|
|
75
|
+
"eslint-plugin-vue": "^9.20.1",
|
|
76
|
+
"eslint-plugin-yml": "^1.12.2",
|
|
77
|
+
"eslint-processor-vue-blocks": "^0.1.1",
|
|
78
|
+
"globals": "^13.24.0",
|
|
79
|
+
"jsonc-eslint-parser": "^2.4.0",
|
|
80
|
+
"local-pkg": "^0.5.0",
|
|
81
|
+
"parse-gitignore": "^2.0.0",
|
|
82
|
+
"picocolors": "^1.0.0",
|
|
83
|
+
"prompts": "^2.4.2",
|
|
84
|
+
"toml-eslint-parser": "^0.9.3",
|
|
85
|
+
"vue-eslint-parser": "^9.4.0",
|
|
86
|
+
"yaml-eslint-parser": "^1.2.2",
|
|
87
|
+
"yargs": "^17.7.2"
|
|
88
|
+
},
|
|
89
|
+
"devDependencies": {
|
|
90
|
+
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
91
|
+
"@antfu/ni": "^0.21.12",
|
|
92
|
+
"@stylistic/eslint-plugin-migrate": "^1.5.4",
|
|
93
|
+
"@types/eslint": "^8.56.2",
|
|
94
|
+
"@types/fs-extra": "^11.0.4",
|
|
95
|
+
"@types/node": "^20.11.5",
|
|
96
|
+
"@types/prompts": "^2.4.9",
|
|
97
|
+
"@types/yargs": "^17.0.32",
|
|
98
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
99
|
+
"@unocss/eslint-plugin": "^0.58.3",
|
|
100
|
+
"bumpp": "^9.3.0",
|
|
101
|
+
"eslint": "npm:eslint-ts-patch@^8.56.0-0",
|
|
102
|
+
"eslint-flat-config-viewer": "^0.1.11",
|
|
103
|
+
"eslint-plugin-format": "^0.1.0",
|
|
104
|
+
"eslint-plugin-react": "^7.33.2",
|
|
105
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
106
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
107
|
+
"eslint-plugin-svelte": "^2.35.1",
|
|
108
|
+
"eslint-ts-patch": "^8.56.0-0",
|
|
109
|
+
"esno": "^4.0.0",
|
|
110
|
+
"execa": "^8.0.1",
|
|
111
|
+
"fast-glob": "^3.3.2",
|
|
112
|
+
"fs-extra": "^11.2.0",
|
|
113
|
+
"lint-staged": "^15.2.0",
|
|
114
|
+
"rimraf": "^5.0.5",
|
|
115
|
+
"simple-git-hooks": "^2.9.0",
|
|
116
|
+
"svelte": "^4.2.9",
|
|
117
|
+
"svelte-eslint-parser": "^0.33.1",
|
|
118
|
+
"tsup": "^8.0.1",
|
|
119
|
+
"typescript": "^5.3.3",
|
|
120
|
+
"vitest": "^1.2.0",
|
|
121
|
+
"vue": "^3.4.14",
|
|
122
|
+
"@curev/eslint-config": "0.3.0"
|
|
123
|
+
},
|
|
124
|
+
"simple-git-hooks": {
|
|
125
|
+
"pre-commit": "npx lint-staged"
|
|
126
|
+
},
|
|
127
|
+
"lint-staged": {
|
|
128
|
+
"*.{jsx,js,vue,ts,tsx}": [
|
|
129
|
+
"eslint --cache --fix"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"scripts": {
|
|
133
|
+
"build": "tsup --format esm,cjs --clean --dts",
|
|
134
|
+
"stub": "tsup --format esm",
|
|
135
|
+
"lint": "eslint --cache .",
|
|
136
|
+
"test": "pnpm run test",
|
|
137
|
+
"bump": "bumpp --commit --push --tag"
|
|
20
138
|
}
|
|
21
139
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FlatConfigItem } from "../types";
|
|
2
|
+
import { pluginComments } from "../plugins";
|
|
3
|
+
|
|
4
|
+
export async function comments(): Promise<FlatConfigItem[]> {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
name: "curev:eslint-comments",
|
|
8
|
+
plugins: {
|
|
9
|
+
"eslint-comments": pluginComments
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
13
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
14
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
15
|
+
"eslint-comments/no-unused-enable": "error"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
}
|