eslint-plugin-svelte3
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -0,1 +1,6 @@ | ||
# 2.7.1 | ||
- Named code blocks were in fact a breaking change, sorry! | ||
- They're now disabled by default, but can be enabled with `svelte3/named-blocks` | ||
# 2.7.0 | ||
@@ -2,0 +7,0 @@ |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const new_block = () => ({ transformed_code: '', line_offsets: null, translations: new Map() }); | ||
let custom_compiler, default_compiler, compiler_options, messages, ignore_warnings, ignore_styles, var_names; | ||
let custom_compiler, default_compiler, compiler_options, messages, ignore_warnings, ignore_styles, named_blocks, var_names; | ||
@@ -295,3 +295,3 @@ // get the total length, number of lines, and length of the last line of a string | ||
// return processed string | ||
return [...blocks].map(([filename, { transformed_code: text }]) => ({ text, filename })); | ||
return [...blocks].map(([filename, { transformed_code: text }]) => named_blocks ? { text, filename } : text); | ||
}; | ||
@@ -372,2 +372,3 @@ | ||
compiler_options = settings['svelte3/compiler-options']; | ||
named_blocks = settings['svelte3/named-blocks']; | ||
// call original Linter#verify | ||
@@ -374,0 +375,0 @@ return verify.call(this, code, config, options); |
{ | ||
"name": "eslint-plugin-svelte3", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "An ESLint plugin for Svelte v3 components.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -91,2 +91,10 @@ # eslint-plugin-svelte3 | ||
### `svelte3/named-blocks` | ||
When an [ESLint processor](https://eslint.org/docs/user-guide/configuring#specifying-processor) processes a file, it is able to output named code blocks, which can each have their own linting configuration. When this setting is enabled, the code extracted from `<script context='module>` tag, the `<script>` tag, and the template are respectively given the block names `module.js`, `instance.js`, and `template.js`. | ||
This means that to override linting rules in Svelte components, you'd instead have to target `**/*.svelte/*.js`. But it also means that you can define an override targeting `**/*.svelte/*_template.js` for example, and that configuration will only apply to linting done on the templates in Svelte components. | ||
The default is to not use named code blocks. | ||
### `svelte3/compiler` | ||
@@ -100,6 +108,2 @@ | ||
## Named code blocks | ||
When an [ESLint processor](https://eslint.org/docs/user-guide/configuring#specifying-processor) processes a file, it is able to output named code blocks, which can each have their own linting configuration. In this plugin, the code extracted from `<script context='module>` tag, the `<script>` tag, and the template are respectively given the block names `module.js`, `instance.js`, and `template.js`. This means that you can define an override targeting `**/*.svelte/*_template.js` for example, and that configuration will only apply to linting done on the templates in Svelte components. | ||
## Using the CLI | ||
@@ -106,0 +110,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24363
346
120