burningTyger
b9368d5de4
remove quotes from code suggestion
2020-01-08 10:07:10 -05:00
David Kondrad
6b5a4870df
tests: validator: add support for customElement compile option + test cases ( #4133 )
2019-12-23 14:06:41 -05:00
Benjamin W. Broersma
3433418dce
Skip JS globals for InlineComponent nodes in warn_if_undefined. ( #4071 )
2019-12-09 09:15:49 -05:00
Conduitry
e996ef750d
fix warnings for props that are only used as stores ( #4021 )
2019-12-04 13:05:29 -05:00
Richard Harris
74fa2447b1
error on empty css declarations - fixes #3801
2019-10-28 10:38:46 -04:00
Tan Li Hau
81c5c480e8
feat: warn unused exports
2019-10-27 13:42:50 +08:00
Richard Harris
ad0e8670ca
tweak text of warning
2019-10-24 21:47:05 -04:00
Tan Li Hau
cfd3b63b9b
warn if using svelte:options tag without compile_options.customElement
2019-10-24 11:54:50 +08:00
Tan Li Hau
5dbb08d19b
allow solo for test suite ( #3747 )
2019-10-23 14:52:49 -04:00
Colin Casey
ee8825d34f
fix reactive declaration cycle detection + clearer error on cycle
...
- fixes #3459
- uses DFS traversal to inspect reactive declarations for cycles
- returns the cycle detected (e.g.; `a → b → a`) for error messaging
2019-09-06 10:12:40 -03:00
Samuel Elgozi
7342d484f1
feat: #3372 added a new self
event modifier
2019-08-08 01:57:47 +03:00
Rich Harris
e41a4846c3
Merge pull request #3348 from sveltejs/gh-3272
...
throw error if $ is referenced as global
2019-08-04 17:51:37 -04:00
Richard Harris
e3e3ad9be0
disable validation with magic comments
2019-08-04 10:58:43 -04:00
Richard Harris
46cd6ff370
disallow global references to $$-prefixed vars
2019-08-04 09:22:14 -04:00
Richard Harris
4c8f3a296c
throw error if $ is referenced as global - fixes #3272
2019-08-03 21:19:40 -04:00
Rich Harris
cf24dbd6a9
Merge pull request #3336 from Conduitry/gh-3274
...
don't warn when using each index in key
2019-08-03 12:30:21 -04:00
Conduitry
c04def9081
don't warn when using each index in key ( #3274 )
2019-08-03 00:30:38 -04:00
Conduitry
276eb8e553
fix erroneous a11y warning with input type='image' ( #3331 )
2019-08-02 12:24:07 -04:00
Rich Harris
1fc4b1c867
add Error to known globals, declare catch block parameter. fixes #3064
2019-06-24 18:09:01 -04:00
Rich Harris
4e8755338a
oops
2019-06-24 13:34:18 -04:00
Rich Harris
86c5086c54
add some docs, rename to textContent and innerHTML
2019-06-24 13:00:16 -04:00
Richard Harris
8d25f5da0a
Merge branch 'master' of https://github.com/leporo/svelte
2019-06-09 17:48:27 -04:00
Rich Harris
1102ff6426
support once modifier on component events, fail on others ( #2987 )
...
* support once modifier on component events, fail on others. fixes #2654
* appease the gods of typescript
2019-06-09 17:34:02 -04:00
Rich Harris
c1960f9ef8
Merge branch 'master' into master
2019-06-09 16:39:30 -04:00
James Garbutt
caebe0deb8
Introduce ESLint to svelte sources ( #2958 )
...
* introduce eslint
* add lint npm script
* first eslint run
* use tsc stronger checks for unused vars
* fix strict typescript unused checks
* reintroduce unicode oddities
* revert ordering changes
* revert whitespace changes
* set indent lint rule as error and ignore outliers
* revert some more unicode
* reintroduce scissors unicode again
2019-06-09 11:31:28 -04:00
Vlad Glushchuk
450464f014
Add bind:text and bind:html support for contenteditable elements
...
Fixes #310
2019-06-06 10:38:45 +02:00
Emil Tholin
3f31223186
Add error for missing equals after attribute name
2019-05-15 18:11:27 +02:00
Rich Harris
f9a66e558b
failing missing-declaration test
2019-05-12 14:25:44 -04:00
Emil Tholin
0286dce026
Warn on improper use of reactive declarations
2019-05-05 15:34:57 +02:00
Rich Harris
78332cf5b0
Merge pull request #2664 from EmilTholin/each-block-destructuring-rest
...
Add support for object-rest in each destructuring
2019-05-04 11:34:37 -04:00
Rich Harris
16dbb8f437
Merge pull request #2607 from EmilTholin/figcaption_figure_first_element_ancestor
...
Check if a figcaption's first element ancestor is a figure
2019-05-04 11:21:39 -04:00
Emil Tholin
97ee67c08f
Add support for object-rest in each destructuring
2019-05-03 12:00:16 +02:00
Emil Tholin
6ebd72fc22
Check if a figcaption's first element ancestor is a figure
2019-04-28 19:15:56 +02:00
Emil Tholin
7ec1bdb712
Don't show 'Empty block' warnings for non-existent await branches
2019-04-27 21:49:55 +02:00
Richard Harris
cd0f535d83
better error for bindings to let: values - fixes #2301
2019-04-13 16:12:06 -04:00
Richard Harris
30c8fe0c6e
allow reactive declarations without dependencies - fixes #2285
2019-04-11 23:29:02 -04:00
Rich Harris
a59cd36a39
Merge pull request #2321 from sveltejs/gh-2295
...
Fix exception and warning for global variables
2019-03-27 08:21:48 -04:00
Conduitry
ecd7c6e9aa
warn on template references to global variables ( #2295 )
2019-03-26 13:51:44 -04:00
Conduitry
fa79a72348
disallow bindings to global variables ( #2295 )
2019-03-26 13:46:28 -04:00
Rich Harris
16106d113d
handle foreignObject correctly, default to svg namespace for top-level svg elements - fixes #2298
2019-03-26 12:10:41 -04:00
Richard Harris
34c4f79998
augment warnings to help people figure out they need to add a <script>
2019-03-16 10:19:25 -04:00
Richard Harris
73e45ab483
update validate tests
2019-03-15 22:44:30 -04:00
Conduitry
a26b276c5e
update tests
2019-03-15 18:39:02 -04:00
Rich Harris
4541d58798
Add a tutorial ( #2132 )
2019-03-10 09:30:29 -04:00
Richard Harris
248f55a574
move warnings out of stats
2019-02-18 13:54:27 -05:00
Richard Harris
f1d4ff6268
remove onwarn option, just use stats.warnings instead
2019-02-17 12:42:48 -05:00
Richard Harris
871147260c
always warn on empty block - fixes #2042
2019-02-17 12:35:17 -05:00
Rich Harris
206a3d0131
update tests
2019-02-08 09:32:36 -05:00
Rich Harris
687e352209
rename .html files to .svelte
2019-02-08 08:48:10 -05:00
Rich Harris
f64a661fa5
better cyclical dependency detection - fixes #2055
2019-02-07 11:11:14 -05:00
Conduitry
a270661d20
rename <svelte:meta>
to <svelte:options>
( #2017 )
2019-01-29 17:59:40 -05:00
Conduitry
67af1a203e
disallow slot
as a prop name in inline components ( #2019 )
2019-01-29 11:25:40 -05:00
Rich Harris
b1d919f3f2
Overhaul stats — closes #1891
2019-01-29 09:10:10 -05:00
Rich Harris
c2e6d1bf0d
Better composition — implements https://github.com/sveltejs/rfcs/pull/12
2019-01-26 18:53:47 -05:00
Richard Harris
88c674079b
always use stats.warn instead of options.onwarn - fixes #1918
2018-12-28 22:19:25 -05:00
Rich Harris
48f1f6b4d0
implement bind:this
2018-12-16 09:26:53 -05:00
Rich Harris
f45e2b70fd
Implement reactive assignments ( #1839 )
...
This also includes elements of RFCs 2 and 3
2018-12-15 19:18:03 -05:00
Rich Harris
b3b95d4ee6
disallow passive|preventDefault combo
2018-10-28 13:58:43 -04:00
Rich Harris
8ec02b336d
disallow once/passive in legacy mode, for now
2018-10-28 13:24:09 -04:00
Rich Harris
aa203973e0
add some more modifier validation tests
2018-10-28 12:33:21 -04:00
Rich Harris
769e03296f
merge master -> gh-1088
2018-10-28 11:29:08 -04:00
Rich Harris
945134bc81
warn on unused helpers - fixes #1704
2018-09-15 17:47:16 -04:00
Rich Harris
c52a6f011b
dont warn on empty block for nbsp - fixes #1658
2018-08-24 08:22:41 -04:00
Admin
7c4b9a5a41
Changes stop and prevent to stopPropagation and preventDefault
2018-08-11 21:16:42 -05:00
Rich Harris
401a6fea5d
handle single identifiers in {@debug} tags
2018-08-11 17:18:43 -04:00
Admin
4004a569e1
Adds tests for valid and invalid debug tag usage.
2018-08-11 00:26:24 -05:00
Admin
adfc0e3e45
Adds invalid test for event-modifiers.
2018-08-09 22:05:31 -05:00
Admin
a3c71af5c5
Changes {@debug _ } to {@debug}
2018-08-08 18:21:33 -05:00
Admin
622e7b0190
Adds debug all option to debug tag
2018-08-08 00:36:52 -05:00
Admin
89412e370e
Adds validation for invalid reference names like foo-bar.
2018-08-05 00:29:38 -05:00
Christian Kaisermann
19d541ab77
Add refs.* to valid event handler callees warning message
2018-06-06 14:32:34 -03:00
Conduitry
5e8a8b95e5
update some stray references to v1 syntax
2018-05-27 15:48:21 -04:00
Rich Harris
94206ca439
add animation validation tests
2018-05-13 18:43:48 -04:00
Rich Harris
4a67542bec
prevent bind:offsetWidth etc on void elements
2018-04-30 08:57:50 -04:00
Rich Harris
fe4637305b
add validation logic, error on dimension bindings for SVG elements
2018-04-29 20:00:02 -04:00
Rich Harris
aaab6853ce
support $method(...) calls, and warn on store.method(...)
2018-04-18 23:35:22 -04:00
Rich Harris
5a457bfb87
rename loc to start, include character info in locations
2018-04-16 21:50:57 -04:00
Rich Harris
b9fcc16d68
update test
2018-04-16 20:53:17 -04:00
Rich Harris
73e83e5571
tidy up
2018-04-16 00:05:51 -04:00
Rich Harris
cae4dd93bf
fix some more tests
2018-04-16 00:03:22 -04:00
Rich Harris
39ad124c99
update validation tests
2018-04-15 23:06:57 -04:00
Rich Harris
1143b0a991
remove v1 tests
2018-04-15 22:19:05 -04:00
Rich Harris
80e0dceb9a
remove validate and Stylesheet from public API
2018-04-15 19:57:12 -04:00
Rich Harris
c1573dbf2c
implement onstate and onupdate
2018-04-15 13:09:59 -04:00
Rich Harris
410f44dced
Merge branch 'master' into gh-1197
2018-04-15 11:30:48 -04:00
Rich Harris
33afb7e49a
add some onstate/onupdate tests
2018-04-15 11:30:36 -04:00
Rich Harris
35f4a1f063
add codes to errors
2018-04-15 10:31:23 -04:00
Rich Harris
b86a1edb52
add codes to validation errors
2018-04-15 00:06:27 -04:00
Rich Harris
f0b2cb99f2
add codes to warnings ( #474 )
2018-04-14 21:38:37 -04:00
Rich Harris
813e077ccc
Merge pull request #1330 from sveltejs/gh-1318
...
implement syntax changes
2018-04-14 18:18:36 -04:00
Rich Harris
0edbac615c
add validator tests
2018-04-12 23:34:46 -04:00
Rich Harris
032083bb34
fix #1331
2018-04-11 21:31:42 -04:00
Rich Harris
0ebe5355e1
Merge pull request #1299 from sveltejs/gh-1257
...
Stats
2018-04-08 10:05:31 -07:00
Rich-Harris
dfc8462d98
fail validation if bound <select> has dynamic multiple attribute - fixes #1270
2018-04-04 08:29:54 -04:00
Rich-Harris
c0287f2080
include warnings in stats object
2018-04-01 14:25:33 -04:00
Josh Duff
864fd313bb
Accept backtick string literals in tag/props properties
2018-03-28 16:12:38 -05:00
Jacob Wright
04f5d5c975
Adds actions to components
...
Actions add additional functionality to elements within your component's template that may be difficult to add with other mechanisms. Examples of functionality which actions makes trivial to attach are:
* tooltips
* image lazy loaders
* drag and drop functionality
Actions can be added to an element with the `use` directive.
```html
<img use:lazyload data-src="giant-photo.jpg>
```
Data may be passed to the action as an object literal (e.g. `use:b="{ setting: true }"`, a literal value (e.g. `use:b="'a string'"`), or a value or function from your component's state (e.g. `add:b="foo"` or `add:b="foo()"`).
Actions are defined in a "actions" property on your component definition.
```html
<script>
export default {
actions: {
b(node, data) {
// do something
return {
update(data) {},
destroy() {}
}
}
}
}
</script>
```
A action is a function which receives a reference to an element and optionally the data if it is added in the HTML. This function can then attach listeners or alter the element as needed. The action can optionally return an object with the methods `update(data)` and `destroy()`.
When data is added in the HTML and comes from state, the action's `update(data)` will be called if defined whenever the state is changed.
When the element is removed from the DOM `destroy()` will be called if provided, allowing for cleanup of event listeners, etc.
See https://github.com/sveltejs/svelte/issues/469 for discussion around this feature and more examples of how it could be used.
2018-03-19 15:23:27 -06:00
James Birtles
89024177fc
Fix named-export end position
2018-03-18 17:22:46 +00:00
James Birtles
da6a74016f
add end position to errors
2018-03-16 03:42:30 +00:00
James Birtles
d07721cd50
add end position to warnings
2018-03-16 03:42:29 +00:00
Rich Harris
fdd9adab4d
add test for #1179
2018-02-23 08:40:02 -05:00
Rich Harris
f77314f647
increase test coverage
2018-02-10 23:29:47 -05:00
Rich Harris
bc6ee3ef9f
increase test coverage, handle immediately-closed blocks
2018-02-10 22:08:39 -05:00
Rich Harris
198f132b28
doh
2018-02-10 11:51:24 -05:00
Rich Harris
ff67b137c4
empty blocks are a dev warning, not an error
2018-02-10 11:46:23 -05:00
Rich Harris
d0be845190
Merge pull request #1106 from sveltejs/gh-1083
...
Enforce valid names for computed properties
2018-01-18 11:48:40 -05:00
Conduitry
49135161bc
do not run a11y validation on child component elements ( #1110 )
2018-01-16 14:39:56 -05:00
Rich Harris
b19303679d
simplify test slightly, add test for reserved words
2018-01-13 22:44:45 -05:00
Rich Harris
146327e87f
fix expected error position, tweak expected message to include suggested alternative
2018-01-13 20:06:29 -05:00
Rich Harris
cfdc8902ab
run prettier (spaces -> tabs)
2018-01-13 20:05:27 -05:00
asweingarten
02afdb03fa
[1083] Svelte should throw a compile time error when illegal characters are used in computed names
...
Approach:
For each property name, construct a string that defines a function and see if parsing that string with Acorn throws an exception.
If it does, assemble an informative error message that states which property is invalid, the first invalid character, and the location of that character within the name.
Changes to codebase:
- Added new validator test
"properties-computed-must-be-valid-function-names"
- Added new check into src/validate/js/propValidators/computed.ts,
"checkForValidIdentifiers"
- this check was added to
src/validate/js/utils/checkForValidIdentifiers.ts like the other
checks in "computed.ts"
2018-01-11 17:48:25 -08:00
Rich Harris
5fea63a5de
validate contents of await blocks ( #1061 )
2018-01-10 22:04:49 -05:00
Emil Ajdyna
5659d10d7c
Allow xlink:href attribute
2018-01-05 20:15:21 +01:00
Rich Harris
b7d8c49dc8
Merge branch 'master' into gh-1027
2017-12-30 10:48:34 -05:00
Rich Harris
646b0c0e01
optimise <title> - fixes #1027
2017-12-24 15:09:38 -05:00
Rich Harris
ab94066932
warn on unused events/transitions - fixes #1051
2017-12-24 13:59:21 -05:00
Rich Harris
146f645502
detect unused/misplaced components - closes #1039
2017-12-24 13:38:57 -05:00
Rich Harris
4b87d20b93
tweak error wording slightly
2017-12-24 08:51:38 -05:00
Emil Ajdyna
d561c93841
Check against this usage in computed functions
2017-12-19 02:53:21 +01:00
Rich Harris
0be3211c4f
fix figcaption a11y warning - fixes #996
2017-12-10 09:57:15 -05:00
Rich Harris
a87d30e0e6
allow event handlers to call store methods
2017-11-24 16:23:32 -05:00
Rich Harris
c9aa72313e
throw error on illegal context ( #934 )
2017-11-23 13:24:54 -05:00
Rich Harris
0a01aa0243
Increase code coverage
2017-11-23 10:36:52 -05:00
Rich Harris
60b883b066
enable <:Window bind:online/> - fixes #936 ( #937 )
2017-11-21 23:15:35 -05:00
Rich Harris
bcae68de06
treat quoted property names the same way as identifiers - fixes #914
2017-11-18 14:54:49 -05:00
Conduitry
cc8614c51c
allow options.* as event handler callee
2017-10-18 13:33:23 -04:00
Rich Harris
64026c3ba9
Merge pull request #854 from sveltejs/gh-782
...
allow console.* calls in event handlers
2017-09-18 21:03:07 -04:00
Rich Harris
d5ad4c007b
update validation message
2017-09-18 20:59:51 -04:00
Rich Harris
9b505de3a0
compile time error on slotted content inside if/each blocks. closes #849
2017-09-16 12:51:48 -04:00
Conduitry
40ae4a42c1
fix a11y-html-has-lang unit test
2017-09-07 22:29:55 -04:00
Rich Harris
c872234a4b
Update input.html
2017-09-07 17:30:18 -04:00
jpsc
8639359aa7
feat(a11y): add warning missing lang on html tag
2017-09-07 23:18:26 +02:00
Rich Harris
7c6ea13689
reenable all tests, fix some failures
2017-09-03 18:50:01 -04:00
Rich Harris
85e9ed9a81
tabindex-no-positive
2017-09-03 18:42:26 -04:00
Rich Harris
915c1835a4
scope
2017-09-03 18:34:30 -04:00
Rich Harris
b3409ad405
no-distracting-elements
2017-09-03 18:23:09 -04:00
Rich Harris
81c5a1fb3b
no-autofocus
2017-09-03 18:19:07 -04:00
Rich Harris
d5b8d2fd48
no-access-key
2017-09-03 18:16:03 -04:00
Rich Harris
2364f6a04d
heading-has-content
2017-09-03 18:04:00 -04:00
Rich Harris
c62a74e8ae
aria-role
2017-09-03 17:51:46 -04:00
Rich Harris
125191a843
aria-props
2017-09-03 17:35:34 -04:00
Rich Harris
073cbc0460
update some tests
2017-09-03 17:18:59 -04:00
Rich Harris
6133976fec
anchor-is-valid
2017-09-03 15:01:15 -04:00
Rich Harris
bacbaef868
anchor-has-content
2017-09-03 14:42:09 -04:00
Rich Harris
51c2e0581b
a11y checks ( #374 )
2017-09-03 14:18:26 -04:00
Rich Harris
502f6b6d14
Merge pull request #793 from sveltejs/gh-791
...
error if component has transition
2017-08-29 11:23:10 -04:00
Rich Harris
cb92f3028e
error if component has transition ( fixes #791 )
2017-08-29 08:09:41 -04:00
Rich Harris
5b3e8cd88f
support nested <slot> elements
2017-08-29 08:02:47 -04:00
Rich Harris
a023346c91
validation
2017-08-27 11:22:02 -04:00
Rich Harris
c1f34e3e2a
validate ref callees ( #686 )
2017-07-29 17:47:10 -04:00