Skip to content

Commit e28d8cf

Browse files
committed
fix default option
1 parent 425d233 commit e28d8cf

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed

docs/rules/no-unused-props.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ Note: Properties of class types are not checked for usage, as they might be used
162162
// Patterns to ignore when checking property types
163163
"ignoreTypePatterns": [],
164164
// Patterns to ignore when checking for unused props
165-
"ignorePropertyPatterns": ["/^[#$@_~]/"],
165+
"ignorePropertyPatterns": [],
166166
}]
167167
}
168168
```
169169

170170
- `checkImportedTypes` ... Controls whether to check properties from imported types. Default is `false`.
171171
- `ignoreTypePatterns` ... Patterns to ignore when checking property types. Default is `[]`.
172-
- `ignorePropertyPatterns` ... Patterns to ignore when checking for unused props. Default is `/["^[#$@_~]"]/`, which ignores properties starting with special characters often used for internal or framework-specific identifiers.
172+
- `ignorePropertyPatterns` ... Patterns to ignore when checking for unused props. Default is `[]`, which ignores properties starting with special characters often used for internal or framework-specific identifiers.
173173

174174
Examples:
175175

packages/eslint-plugin-svelte/src/rules/no-unused-props.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ export default createRule('no-unused-props', {
3737
items: {
3838
type: 'string'
3939
},
40-
// For example, valibot generates symbol like `__@BrandSymbol@1167`.
41-
// So, we ignore properties starting with special characters often used for internal or framework-specific identifiers.
42-
default: ['^[#$@_~]']
40+
default: []
4341
}
4442
},
4543
additionalProperties: false
@@ -103,7 +101,7 @@ export default createRule('no-unused-props', {
103101

104102
const ignorePropertyPatterns = [
105103
...ignorePatterns,
106-
...(options.ignorePropertyPatterns ?? [/^[#$@_~]/]).map((p: string | RegExp) => {
104+
...(options.ignorePropertyPatterns ?? []).map((p: string | RegExp) => {
107105
if (typeof p === 'string') {
108106
return toRegExp(p);
109107
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"options": [
33
{
4-
"ignorePropertyPatterns": ["/^foo$/"]
4+
"ignorePropertyPatterns": ["/^[#$@_~]/"]
55
}
66
]
77
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<script lang="ts">
22
interface Props {
3-
foo: string;
4-
bar: string;
3+
_internal: string;
4+
$store: boolean;
5+
'@decorator': string;
6+
'#private': number;
7+
'~tilde': boolean;
8+
normalUsed: string;
59
}
610
7-
const { bar }: Props = $props();
11+
const { normalUsed }: Props = $props();
12+
console.log(normalUsed);
813
</script>
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
<script lang="ts">
22
interface Props {
3-
_internal: string;
4-
$store: boolean;
5-
'@decorator': string;
6-
'#private': number;
7-
'~tilde': boolean;
8-
normalUsed: string;
3+
foo: string;
4+
bar: string;
95
}
106
11-
const { normalUsed }: Props = $props();
12-
console.log(normalUsed);
7+
const { foo, bar }: Props = $props();
138
</script>

0 commit comments

Comments
 (0)