Skip to content

Commit a0e915a

Browse files
committed
Merge branch 'main' of github.com:ota-meshi/eslint-plugin-svelte
2 parents a74299e + e00d582 commit a0e915a

File tree

11 files changed

+57
-20
lines changed

11 files changed

+57
-20
lines changed

.changeset/strong-wombats-worry.md

-5
This file was deleted.

.changeset/tasty-houses-behave.md

-5
This file was deleted.

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# eslint-plugin-svelte
22

3+
## 2.19.1
4+
5+
### Patch Changes
6+
7+
- [#383](https://github.com/ota-meshi/eslint-plugin-svelte/pull/383) [`08aace5`](https://github.com/ota-meshi/eslint-plugin-svelte/commit/08aace561ab4f013b4eda47f829bc7fa545d5c9f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for read property in `svelte/no-dom-manipulating`
8+
9+
## 2.19.0
10+
11+
### Minor Changes
12+
13+
- [#375](https://github.com/ota-meshi/eslint-plugin-svelte/pull/375) [`d692baf`](https://github.com/ota-meshi/eslint-plugin-svelte/commit/d692baf88637c8aca066d4abe62450b2b9f9940f) Thanks [@ptrxyz](https://github.com/ptrxyz)! - Change to use `parserServices.program.getCompilerOptions().target` for TS transpile in `svelte/valid-compile` rule.
14+
15+
## 2.18.0
16+
17+
### Minor Changes
18+
19+
- [#368](https://github.com/ota-meshi/eslint-plugin-svelte/pull/368) [`fcb5e31`](https://github.com/ota-meshi/eslint-plugin-svelte/commit/fcb5e319620b1cc71ffe579760033813bd719410) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the `svelte/experimental-require-slot-types` rule
20+
21+
- [#365](https://github.com/ota-meshi/eslint-plugin-svelte/pull/365) [`e61bbc3`](https://github.com/ota-meshi/eslint-plugin-svelte/commit/e61bbc347f416f19e9e1e026c4d692e404776023) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the `svelte/experimental-require-strict-events` rule
22+
323
## 2.17.0
424

525
### Minor Changes

docs/rules/experimental-require-slot-types.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ pageClass: "rule-details"
33
sidebarDepth: 0
44
title: "svelte/experimental-require-slot-types"
55
description: "require slot type declaration using the `$$Slots` interface"
6+
since: "v2.18.0"
67
---
78

89
# svelte/experimental-require-slot-types
910

1011
> require slot type declaration using the `$$Slots` interface
1112
12-
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> **_This rule has not been released yet._** </badge>
13-
1413
## :book: Rule Details
1514

1615
This rule enforces the presence of the `$$Slots` interface if any slots are present in the component. This interface declares all of the used slots and their props and enables typechecking both in the component itself as well as all components that include it.
@@ -107,6 +106,10 @@ The `$$Slots` interface is experimental and is documented in [svelte RFC #38](h
107106

108107
Nothing.
109108

109+
## :rocket: Version
110+
111+
This rule was introduced in eslint-plugin-svelte v2.18.0
112+
110113
## :mag: Implementation
111114

112115
- [Rule source](https://github.com/ota-meshi/eslint-plugin-svelte/blob/main/src/rules/experimental-require-slot-types.ts)

docs/rules/experimental-require-strict-events.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ pageClass: "rule-details"
33
sidebarDepth: 0
44
title: "svelte/experimental-require-strict-events"
55
description: "require the strictEvents attribute on `<script>` tags"
6+
since: "v2.18.0"
67
---
78

89
# svelte/experimental-require-strict-events
910

1011
> require the strictEvents attribute on `<script>` tags
1112
12-
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> **_This rule has not been released yet._** </badge>
13-
1413
## :book: Rule Details
1514

1615
This rule enforces the presence of the `strictEvents` attribute on the main `<script>` tag of all components. This attributes enforces typechecking of events dispatched by the component, e.g. making it a typescript error to listen to any non-existent events. Alternatively, the event types may be defined manually by declaring the `$$Events` interface. The `strictEvents` attribute and the `$$Events` interface are experimental and are documented in [svelte RFC #38](https://github.com/dummdidumm/rfcs/blob/ts-typedefs-within-svelte-components/text/ts-typing-props-slots-events.md#typing-events).
@@ -59,6 +58,10 @@ This rule enforces the presence of the `strictEvents` attribute on the main `<sc
5958

6059
Nothing.
6160

61+
## :rocket: Version
62+
63+
This rule was introduced in eslint-plugin-svelte v2.18.0
64+
6265
## :mag: Implementation
6366

6467
- [Rule source](https://github.com/ota-meshi/eslint-plugin-svelte/blob/main/src/rules/experimental-require-strict-events.ts)

lint-staged.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"use strict"
22

3-
module.exports = require("@1stg/lint-staged/tsc")
3+
module.exports = require("@1stg/lint-staged")

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-svelte",
3-
"version": "2.17.0",
3+
"version": "2.19.1",
44
"description": "ESLint plugin for Svelte using AST",
55
"repository": "git+https://github.com/ota-meshi/eslint-plugin-svelte.git",
66
"homepage": "https://ota-meshi.github.io/eslint-plugin-svelte",
@@ -69,7 +69,7 @@
6969
"debug": "^4.3.1",
7070
"eslint-utils": "^3.0.0",
7171
"esutils": "^2.0.3",
72-
"known-css-properties": "^0.26.0",
72+
"known-css-properties": "^0.27.0",
7373
"postcss": "^8.4.5",
7474
"postcss-load-config": "^3.1.4",
7575
"postcss-safe-parser": "^6.0.0",
@@ -140,7 +140,7 @@
140140
"less": "^4.1.2",
141141
"lint-staged": "^13.0.3",
142142
"locate-character": "^2.0.5",
143-
"magic-string": "^0.27.0",
143+
"magic-string": "^0.30.0",
144144
"markdown-it-anchor": "^8.4.1",
145145
"markdown-it-container": "^3.0.0",
146146
"markdown-it-emoji": "^2.0.0",
@@ -174,7 +174,7 @@
174174
"access": "public"
175175
},
176176
"typeCoverage": {
177-
"atLeast": 99.08,
177+
"atLeast": 99,
178178
"cache": true,
179179
"detail": true,
180180
"ignoreAsAssertion": true,

src/rules/no-dom-manipulating.ts

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export default createRule("no-dom-manipulating", {
7878
if (parent.left !== target || !DOM_MANIPULATING_PROPERTIES.has(name)) {
7979
return
8080
}
81+
} else {
82+
return
8183
}
8284
context.report({
8385
node: member,

src/shared/svelte-compile-warns/transform/typescript.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export function transform(
2929
const output = ts.transpileModule(code, {
3030
reportDiagnostics: false,
3131
compilerOptions: {
32-
target: ts.ScriptTarget.ESNext,
32+
target:
33+
context.parserServices.program?.getCompilerOptions()?.target ||
34+
ts.ScriptTarget.ESNext,
35+
module: ts.ModuleKind.ESNext,
3336
importsNotUsedAsValues: ts.ImportsNotUsedAsValues.Preserve,
3437
sourceMap: true,
3538
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script>
2+
let divElement
3+
let height = ""
4+
5+
$: if (divElement) height = `${divElement.clientHeight}px`
6+
</script>
7+
8+
<div bind:this={divElement} />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script>
2+
let divElement
3+
let foo = ""
4+
5+
$: if (divElement) foo = `${divElement.data.foo}`
6+
</script>
7+
8+
<div bind:this={divElement} data-foo="Foo" />

0 commit comments

Comments
 (0)