Skip to content

Commit 435691b

Browse files
committed
adjust
1 parent 16c7f1f commit 435691b

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

.changeset/crazy-peas-laugh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'eslint-plugin-svelte': minor
33
---
44

5-
feat: add `ignorePropertyPatterns` property and rename `ignorePatterns` to `ignoreTypePatterns` in `no-unused-props` rule. The `ignorePatterns` option existed only for a few days and is removed by this PR. Technically, this is a breaking change, but we’ll handle it as a minor release since very few users are likely affected.
5+
feat: add `ignorePropertyPatterns` property and rename `ignorePatterns` to `ignoreTypePatterns` in `no-unused-props` rule. The `ignorePatterns` option existed only for a few hours and is removed by this PR. Technically, this is a breaking change, but we’ll handle it as a minor release since very few users are likely affected.

docs/rules/no-unused-props.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Examples:
211211
/* eslint svelte/no-unused-props: ["error", { "ignorePropertyPatterns": ["/^_/"] }] */
212212
// Ignore properties with names matching the pattern
213213
interface Props {
214-
_internal: string; // This prop won't be reported even if unused
214+
_internal: string;
215215
value: number;
216216
}
217217
let { value }: Props = $props();

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

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,38 +76,28 @@ export default createRule('no-unused-props', {
7676
// From v3.3.0, it was replaced with `ignorePropertyPatterns` and `ignoreTypePatterns`.
7777
if (options.ignorePatterns != null && !isDeprecationWarningShown) {
7878
console.warn(
79-
'eslint-plugin-svelte: The `ignorePatterns` option in the `no-unused-props` rule has been deprecated. Please use `ignorePropertyPatterns` and `ignoreTypePatterns` instead.'
79+
'eslint-plugin-svelte: The `ignorePatterns` option in the `no-unused-props` rule has been removed. Please use `ignorePropertyPatterns` or/and `ignoreTypePatterns` instead.'
8080
);
8181
isDeprecationWarningShown = true;
8282
}
8383

8484
const checkImportedTypes = options.checkImportedTypes ?? false;
85-
const ignorePatterns = (options.ignorePatterns ?? []).map((p: string | RegExp) => {
85+
86+
const ignoreTypePatterns = (options.ignoreTypePatterns ?? []).map((p: string | RegExp) => {
8687
if (typeof p === 'string') {
8788
return toRegExp(p);
8889
}
8990
return p;
9091
});
9192

92-
const ignoreTypePatterns = [
93-
...ignorePatterns,
94-
...(options.ignoreTypePatterns ?? []).map((p: string | RegExp) => {
93+
const ignorePropertyPatterns = (options.ignorePropertyPatterns ?? []).map(
94+
(p: string | RegExp) => {
9595
if (typeof p === 'string') {
9696
return toRegExp(p);
9797
}
9898
return p;
99-
})
100-
];
101-
102-
const ignorePropertyPatterns = [
103-
...ignorePatterns,
104-
...(options.ignorePropertyPatterns ?? []).map((p: string | RegExp) => {
105-
if (typeof p === 'string') {
106-
return toRegExp(p);
107-
}
108-
return p;
109-
})
110-
];
99+
}
100+
);
111101

112102
function shouldIgnoreProperty(name: string): boolean {
113103
return ignorePropertyPatterns.some((pattern: RegExp) => pattern.test(name));

0 commit comments

Comments
 (0)