eslint-plugin-svelte
Advanced tools
Comparing version 1.1.2 to 2.0.0
144
package.json
{ | ||
"name": "eslint-plugin-svelte", | ||
"version": "1.1.2", | ||
"repository": "git+https://github.com/JounQin/eslint-plugin-svelte.git", | ||
"author": "JounQin <admin@1stg.me>", | ||
"license": "MIT", | ||
"version": "2.0.0", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"description": "ESLint plugin for Svelte using AST", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"index.js", | ||
"processor-options.js" | ||
"lib" | ||
], | ||
"engines": { | ||
"node": "^14.17.0 || >=16.0.0" | ||
}, | ||
"packageManager": "yarn@1.22.0", | ||
"scripts": { | ||
"lint": "eslint --ext js,md,svelte ." | ||
"prebuild": "yarn clean", | ||
"build": "yarn build:ts", | ||
"build:ts": "tsc --project ./tsconfig.build.json", | ||
"clean": "rimraf .nyc_output lib coverage build .svelte-kit svelte.config-dist.js", | ||
"pretest:base": "cross-env DEBUG=eslint-plugin-svelte*", | ||
"test": "mocha --require ts-node/register \"tests/src/**/*.ts\" --reporter dot --timeout 60000", | ||
"cover": "nyc --reporter=lcov yarn test", | ||
"debug": "mocha --require ts-node/register/transpile-only \"tests/src/**/*.ts\" --reporter dot --timeout 60000", | ||
"lint": "eslint .", | ||
"eslint-fix": "eslint . --fix", | ||
"update": "ts-node --transpile-only ./tools/update.ts && yarn format-for-gen-file", | ||
"format-for-gen-file": "eslint src/types-for-node.ts src/utils/rules.ts src/configs --fix", | ||
"new": "ts-node --transpile-only ./tools/new-rule.ts", | ||
"docs:watch": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js dev", | ||
"docs:build": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js build", | ||
"docs:preview": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js preview", | ||
"preversion": "yarn test && git add .", | ||
"version": "env-cmd -e version yarn update && git add .", | ||
"prepublishOnly": "yarn clean && yarn build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ota-meshi/eslint-plugin-svelte.git" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"eslint-plugin", | ||
"eslintplugin", | ||
"svelte", | ||
"sveltejs" | ||
], | ||
"author": "Yosuke Ota (https://github.com/ota-meshi)", | ||
"contributors": [ | ||
"JounQin (https://github.com/JounQin)" | ||
], | ||
"funding": "https://github.com/sponsors/ota-meshi", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ota-meshi/eslint-plugin-svelte/issues" | ||
}, | ||
"homepage": "https://ota-meshi.github.io/eslint-plugin-svelte/", | ||
"dependencies": { | ||
"eslint-plugin-svelte3": "^3.1.2" | ||
"debug": "^4.3.1", | ||
"eslint-utils": "^3.0.0", | ||
"known-css-properties": "^0.25.0", | ||
"postcss": "^8.4.5", | ||
"postcss-load-config": "^3.1.4", | ||
"postcss-safe-parser": "^6.0.0", | ||
"sourcemap-codec": "^1.4.8", | ||
"svelte-eslint-parser": "^0.16.0" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^7.0.0 || ^8.0.0-0", | ||
"svelte": "^3.37.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"svelte": { | ||
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
"@1stg/common-config": "^1.2.8", | ||
"@babel/core": "^7.16.0", | ||
"@babel/eslint-parser": "^7.17.0", | ||
"@babel/plugin-proposal-function-bind": "^7.16.7", | ||
"@babel/types": "^7.16.0", | ||
"@fontsource/fira-mono": "^4.5.0", | ||
"@ota-meshi/eslint-plugin": "^0.10.0", | ||
"@sindresorhus/slugify": "^2.1.0", | ||
"@sveltejs/adapter-static": "^1.0.0-next.26", | ||
"@sveltejs/kit": "^1.0.0-next.240", | ||
"@types/babel__core": "^7.1.19", | ||
"@types/eslint": "^8.0.0", | ||
"@types/eslint-scope": "^3.7.0", | ||
"@types/eslint-visitor-keys": "^1.0.0", | ||
"@types/estree": "^0.0.52", | ||
"@types/less": "^3.0.3", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^16.0.0", | ||
"@types/postcss-safe-parser": "^5.0.1", | ||
"@types/stylus": "^0.48.38", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
"@typescript-eslint/parser": "^5.4.1-0", | ||
"@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@4", | ||
"assert": "^2.0.0", | ||
"env-cmd": "^10.1.0", | ||
"esbuild": "^0.14.1", | ||
"esbuild-register": "^3.2.0", | ||
"escape-html": "^1.0.3", | ||
"eslint": "^8.0.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-eslint-plugin": "^4.0.0", | ||
"eslint-plugin-json-schema-validator": "^3.0.0", | ||
"eslint-plugin-jsonc": "^2.0.0", | ||
"eslint-plugin-markdown": "^2.1.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-node-dependencies": "^0.8.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-regexp": "^1.0.0", | ||
"eslint-plugin-svelte": "link:.", | ||
"svelte": "^3.33.0", | ||
"typescript": "^4.2.2" | ||
"eslint-plugin-yml": "^1.0.0", | ||
"estree-walker": "^3.0.0", | ||
"less": "^4.1.2", | ||
"locate-character": "^2.0.5", | ||
"magic-string": "^0.26.0", | ||
"markdown-it-anchor": "^8.4.1", | ||
"markdown-it-container": "^3.0.0", | ||
"markdown-it-emoji": "^2.0.0", | ||
"mocha": "^10.0.0", | ||
"nyc": "^15.1.0", | ||
"pako": "^2.0.3", | ||
"pirates": "^4.0.1", | ||
"postcss-nested": "^5.0.6", | ||
"prettier": "^2.2.1", | ||
"prettier-plugin-svelte": "^2.6.0", | ||
"prism-svelte": "^0.5.0", | ||
"prismjs": "^1.25.0", | ||
"sass": "^1.51.0", | ||
"semver": "^7.3.5", | ||
"stylelint": "^14.0.0", | ||
"stylelint-config-standard": "^26.0.0", | ||
"stylus": "^0.58.0", | ||
"svelte": "^3.46.1", | ||
"svelte-adapter-ghpages": "0.0.2", | ||
"ts-node": "^10.0.0", | ||
"typescript": "^4.5.2", | ||
"vite-plugin-svelte-md": "^0.1.3" | ||
} | ||
} |
366
README.md
@@ -1,84 +0,348 @@ | ||
# eslint-plugin-svelte | ||
# Introduction | ||
[![npm](https://img.shields.io/npm/v/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte) | ||
[![GitHub Release](https://img.shields.io/github/release/JounQin/eslint-plugin-svelte)](https://github.com/JounQin/eslint-plugin-svelte/releases) | ||
`eslint-plugin-svelte` is [ESLint] plugin for [Svelte]. | ||
It provides many unique check rules by using the template AST. | ||
You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-svelte/playground/). | ||
[![David Peer](https://img.shields.io/david/peer/JounQin/eslint-plugin-svelte.svg)](https://david-dm.org/JounQin/eslint-plugin-svelte?type=peer) | ||
[![David](https://img.shields.io/david/JounQin/eslint-plugin-svelte.svg)](https://david-dm.org/JounQin/eslint-plugin-svelte) | ||
[![David Dev](https://img.shields.io/david/dev/JounQin/eslint-plugin-svelte.svg)](https://david-dm.org/JounQin/eslint-plugin-svelte?type=dev) | ||
[![NPM license](https://img.shields.io/npm/l/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte) | ||
[![NPM version](https://img.shields.io/npm/v/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte) | ||
[![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads&colorB=green&suffix=/day&query=$.downloads&uri=https://api.npmjs.org//downloads/point/last-day/eslint-plugin-svelte&maxAge=3600)](http://www.npmtrends.com/eslint-plugin-svelte) | ||
[![NPM downloads](https://img.shields.io/npm/dw/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte) | ||
[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte) | ||
[![NPM downloads](https://img.shields.io/npm/dy/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte) | ||
[![NPM downloads](https://img.shields.io/npm/dt/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte) | ||
[![Build Status](https://github.com/ota-meshi/eslint-plugin-svelte/workflows/CI/badge.svg?branch=main)](https://github.com/ota-meshi/eslint-plugin-svelte/actions?query=workflow%3ACI) | ||
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) | ||
## :name_badge: What is this plugin? | ||
- [What](#what) | ||
- [Why](#why) | ||
- [How](#how) | ||
- [Version strategy](#version-strategy) | ||
- [Usage](#usage) | ||
- [License](#license) | ||
[ESLint] plugin for [Svelte]. | ||
It provides many unique check rules using the AST generated by [svelte-eslint-parser]. | ||
## What | ||
### ❓ Why? | ||
Just an alias to [`eslint-plugin-svelte3`][] | ||
[Svelte] has the official [ESLint] plugin the [eslint-plugin-svelte3]. The [eslint-plugin-svelte3] works well enough to check scripts. However, it does not handle the AST of the template, which makes it very difficult for third parties to create their own the [ESLint] rules for the [Svelte]. | ||
## Why | ||
The [svelte-eslint-parser] aims to make it easy to create your own rules for the [Svelte] by allowing the template AST to be used in the rules. | ||
Personally I'd prefer a consistent eslint plugin for all versions of a framework like [`eslint-plugin-vue`](https://github.com/vuejs/eslint-plugin-vue), but the original author of this plugin has [different opinion](https://github.com/sveltejs/eslint-plugin-svelte3/issues/90#issuecomment-783570346). So I decide to just post this alias package for constant and cleaner usage for myself. | ||
### ❗ Attention | ||
## How | ||
The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3]. | ||
### Version strategy | ||
[svelte-eslint-parser]: https://github.com/ota-meshi/svelte-eslint-parser | ||
[eslint-plugin-svelte3]: https://github.com/sveltejs/eslint-plugin-svelte3 | ||
We will start from `v1.1.1` which represents `v3.1.1` of [`eslint-plugin-svelte3`][] , and follow all of its versions then. What means maybe following (notice: the version of `eslint-plugin-svelte*` are all just assumptions): | ||
<!--DOCS_IGNORE_START--> | ||
1. patch: `eslint-plugin-svelte3@3.1.2` -> `eslint-plugin-svelte@1.1.2` | ||
2. minor: `eslint-plugin-svelte3@3.2.0` -> `eslint-plugin-svelte@1.2.0` | ||
3. major: | ||
1. `eslint-plugin-svelte3@4.3.0` -> `eslint-plugin-svelte@2.3.0` | ||
2. `eslint-plugin-svelte4@0.4.1` -> `eslint-plugin-svelte@3.4.1` | ||
3. `eslint-plugin-svelte4@1.5.1` -> `eslint-plugin-svelte@4.5.1` | ||
## Migration Guide | ||
If we are changing some internal codes, the version would be `x.y.z-minor.patch`. | ||
To migrate from `eslint-plugin-svelte` v1, or `@ota-meshi/eslint-plugin-svelte`, please refer to the [migration guide](https://ota-meshi.github.io/eslint-plugin-svelte/migration/). | ||
### Usage | ||
## :book: Documentation | ||
It should be just like [`eslint-plugin-svelte3`][] itself, but renaming all `svelte*` to simple `svelte`, for instance: | ||
See [documents](https://ota-meshi.github.io/eslint-plugin-svelte/). | ||
## :cd: Installation | ||
```bash | ||
npm install --save-dev eslint eslint-plugin-svelte svelte | ||
``` | ||
> **Requirements** | ||
> | ||
> - ESLint v7.0.0 and above | ||
> - Node.js v14.17.x, v16.x and above | ||
<!--DOCS_IGNORE_END--> | ||
## :book: Usage | ||
<!--USAGE_SECTION_START--> | ||
<!--USAGE_GUIDE_START--> | ||
### Configuration | ||
Use `.eslintrc.*` file to configure rules. See also: [https://eslint.org/docs/user-guide/configuring](https://eslint.org/docs/user-guide/configuring). | ||
Example **.eslintrc.js**: | ||
```js | ||
module.exports = { | ||
extends: [ | ||
// add more generic rule sets here, such as: | ||
// 'eslint:recommended', | ||
"plugin:svelte/recommended", | ||
], | ||
rules: { | ||
// override/add rules settings here, such as: | ||
// 'svelte/rule-name': 'error' | ||
}, | ||
} | ||
``` | ||
This plugin provides configs: | ||
- `plugin:svelte/base` ... Configuration to enable correct Svelte parsing. | ||
- `plugin:svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior. | ||
See [the rule list](https://ota-meshi.github.io/eslint-plugin-svelte/rules/) to get the `rules` that this plugin provides. | ||
::: warning ❗ Attention | ||
The `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3]. | ||
If you are using [eslint-plugin-svelte3] you need to remove it. | ||
```diff | ||
"plugins": [ | ||
- "svelte3" | ||
] | ||
``` | ||
::: | ||
#### Parser Configuration | ||
If you have specified a parser, you need to configure a parser for `.svelte`. | ||
For example, if you are using the `"@babel/eslint-parser"`, configure it as follows: | ||
```js | ||
module.exports = { | ||
// ... | ||
extends: ["plugin:svelte/recommended"], | ||
// ... | ||
parser: "@babel/eslint-parser", | ||
// Add an `overrides` section to add a parser configuration for svelte. | ||
overrides: [ | ||
{ | ||
files: ["*.svelte"], | ||
parser: "svelte-eslint-parser", | ||
}, | ||
// ... | ||
], | ||
// ... | ||
} | ||
``` | ||
For example, if you are using the `"@typescript-eslint/parser"`, and if you want to use TypeScript in `<script>` of `.svelte`, you need to add more `parserOptions` configuration. | ||
```js | ||
module.exports = { | ||
// ... | ||
extends: ["plugin:svelte/recommended"], | ||
// ... | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: 2019, | ||
sourceType: 'module', | ||
// ... | ||
project: "path/to/your/tsconfig.json", | ||
extraFileExtensions: [".svelte"], // This is a required setting in `@typescript-eslint/parser` v4.24.0. | ||
}, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
}, | ||
plugins: ['svelte'], | ||
overrides: [ | ||
{ | ||
files: ['*.svelte'], | ||
processor: 'svelte/svelte', | ||
files: ["*.svelte"], | ||
parser: "svelte-eslint-parser", | ||
// Parse the `<script>` in `.svelte` as TypeScript by adding the following configuration. | ||
parserOptions: { | ||
parser: "@typescript-eslint/parser", | ||
}, | ||
}, | ||
// ... | ||
], | ||
rules: { | ||
// ... | ||
} | ||
``` | ||
If you have a mix of TypeScript and JavaScript in your project, use a multiple parser configuration. | ||
```js | ||
module.exports = { | ||
// ... | ||
overrides: [ | ||
{ | ||
files: ["*.svelte"], | ||
parser: "svelte-eslint-parser", | ||
parserOptions: { | ||
parser: { | ||
// Specify a parser for each lang. | ||
ts: "@typescript-eslint/parser", | ||
js: "espree", | ||
typescript: "@typescript-eslint/parser", | ||
}, | ||
}, | ||
}, | ||
// ... | ||
}, | ||
], | ||
// ... | ||
} | ||
``` | ||
See also [https://github.com/ota-meshi/svelte-eslint-parser#readme](https://github.com/ota-meshi/svelte-eslint-parser#readme). | ||
#### settings.svelte | ||
You can change the behavior of this plugin with some settings. | ||
- `ignoreWarnings` (optional) ... Specifies an array of rules that ignore reports in the template. | ||
For example, set rules on the template that cannot avoid false positives. | ||
- `compileOptions` (optional) ... Specifies options for Svelte compile. Effects rules that use Svelte compile. The target rules are [svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile/) and [svelte/no-unused-svelte-ignore](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/). **Note that it has no effect on ESLint's custom parser**. | ||
- `postcss` (optional) ... Specifies options related to PostCSS. You can disable the PostCSS process by specifying `false`. | ||
- `configFilePath` (optional) ... Specifies the path of the directory containing the PostCSS configuration. | ||
e.g. | ||
```js | ||
module.exports = { | ||
// ... | ||
settings: { | ||
'svelte/typescript': require('typescript'), // pass the TypeScript package to the Svelte plugin | ||
// ... | ||
svelte: { | ||
ignoreWarnings: [ | ||
"@typescript-eslint/no-unsafe-assignment", | ||
"@typescript-eslint/no-unsafe-member-access", | ||
], | ||
compileOptions: { | ||
postcss: { | ||
configFilePath: "./path/to/my/postcss.config.js", | ||
}, | ||
}, | ||
}, | ||
}, | ||
// ... | ||
} | ||
``` | ||
Don't forget to read original documentation first. | ||
### Running ESLint from the command line | ||
## License | ||
If you want to run `eslint` from the command line, make sure you include the `.svelte` extension using [the `--ext` option](https://eslint.org/docs/user-guide/configuring#specifying-file-extensions-to-lint) or a glob pattern, because ESLint targets only `.js` files by default. | ||
[MIT][] © [JounQin][]@[1stG.me][] | ||
Examples: | ||
[1stg.me]: https://www.1stg.me | ||
[jounqin]: https://GitHub.com/JounQin | ||
[mit]: http://opensource.org/licenses/MIT | ||
[`eslint-plugin-svelte3`]: https://github.com/sveltejs/eslint-plugin-svelte3 | ||
```bash | ||
eslint --ext .js,.svelte src | ||
eslint "src/**/*.{js,svelte}" | ||
``` | ||
## :computer: Editor Integrations | ||
### Visual Studio Code | ||
Use the [dbaeumer.vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension that Microsoft provides officially. | ||
You have to configure the `eslint.validate` option of the extension to check `.svelte` files, because the extension targets only `*.js` or `*.jsx` files by default. | ||
Example **.vscode/settings.json**: | ||
```json | ||
{ | ||
"eslint.validate": ["javascript", "javascriptreact", "svelte"] | ||
} | ||
``` | ||
<!--USAGE_GUIDE_END--> | ||
<!--USAGE_SECTION_END--> | ||
## :white_check_mark: Rules | ||
<!--RULES_SECTION_START--> | ||
The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below. | ||
The rules with the following star :star: are included in the configs. | ||
<!--RULES_TABLE_START--> | ||
## Possible Errors | ||
These rules relate to possible syntax or logic errors in Svelte code: | ||
| Rule ID | Description | | | ||
|:--------|:------------|:---| | ||
| [svelte/no-dupe-else-if-blocks](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-else-if-blocks/) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: | | ||
| [svelte/no-dupe-style-properties](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-style-properties/) | disallow duplicate style properties | :star: | | ||
| [svelte/no-dynamic-slot-name](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | disallow dynamic slot name | :star::wrench: | | ||
| [svelte/no-not-function-handler](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-not-function-handler/) | disallow use of not function in event handler | :star: | | ||
| [svelte/no-object-in-text-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches/) | disallow objects in text mustache interpolation | :star: | | ||
| [svelte/no-shorthand-style-property-overrides](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-shorthand-style-property-overrides/) | disallow shorthand style properties that override related longhand properties | :star: | | ||
| [svelte/no-unknown-style-directive-property](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unknown-style-directive-property/) | disallow unknown `style:property` | :star: | | ||
| [svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile/) | disallow warnings when compiling. | :star: | | ||
## Security Vulnerability | ||
These rules relate to security vulnerabilities in Svelte code: | ||
| Rule ID | Description | | | ||
|:--------|:------------|:---| | ||
| [svelte/no-at-html-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-html-tags/) | disallow use of `{@html}` to prevent XSS attack | :star: | | ||
| [svelte/no-target-blank](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-target-blank/) | disallow `target="_blank"` attribute without `rel="noopener noreferrer"` | | | ||
## Best Practices | ||
These rules relate to better ways of doing things to help you avoid problems: | ||
| Rule ID | Description | | | ||
|:--------|:------------|:---| | ||
| [svelte/button-has-type](https://ota-meshi.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute | | | ||
| [svelte/no-at-debug-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: | | ||
| [svelte/no-unused-svelte-ignore](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/) | disallow unused svelte-ignore comments | :star: | | ||
| [svelte/no-useless-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :wrench: | | ||
| [svelte/require-optimized-style-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/require-optimized-style-attribute/) | require style attributes that can be optimized | | | ||
## Stylistic Issues | ||
These rules relate to style guidelines, and are therefore quite subjective: | ||
| Rule ID | Description | | | ||
|:--------|:------------|:---| | ||
| [svelte/first-attribute-linebreak](https://ota-meshi.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak/) | enforce the location of first attribute | :wrench: | | ||
| [svelte/html-quotes](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-quotes/) | enforce quotes style of HTML attributes | :wrench: | | ||
| [svelte/indent](https://ota-meshi.github.io/eslint-plugin-svelte/rules/indent/) | enforce consistent indentation | :wrench: | | ||
| [svelte/max-attributes-per-line](https://ota-meshi.github.io/eslint-plugin-svelte/rules/max-attributes-per-line/) | enforce the maximum number of attributes per line | :wrench: | | ||
| [svelte/mustache-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/mustache-spacing/) | enforce unified spacing in mustache | :wrench: | | ||
| [svelte/prefer-class-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-class-directive/) | require class directives instead of ternary expressions | :wrench: | | ||
| [svelte/prefer-style-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-style-directive/) | require style directives instead of style attribute | :wrench: | | ||
| [svelte/shorthand-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-attribute/) | enforce use of shorthand syntax in attribute | :wrench: | | ||
| [svelte/shorthand-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-directive/) | enforce use of shorthand syntax in directives | :wrench: | | ||
| [svelte/spaced-html-comment](https://ota-meshi.github.io/eslint-plugin-svelte/rules/spaced-html-comment/) | enforce consistent spacing after the `<!--` and before the `-->` in a HTML comment | :wrench: | | ||
## Extension Rules | ||
These rules extend the rules provided by ESLint itself to work well in Svelte: | ||
| Rule ID | Description | | | ||
|:--------|:------------|:---| | ||
| [svelte/no-inner-declarations](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-inner-declarations/) | disallow variable or `function` declarations in nested blocks | :star: | | ||
## System | ||
These rules relate to this plugin works: | ||
| Rule ID | Description | | | ||
|:--------|:------------|:---| | ||
| [svelte/comment-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/comment-directive/) | support comment-directives in HTML template | :star: | | ||
| [svelte/system](https://ota-meshi.github.io/eslint-plugin-svelte/rules/system/) | system rule for working this plugin | :star: | | ||
<!--RULES_TABLE_END--> | ||
<!--RULES_SECTION_END--> | ||
<!--DOCS_IGNORE_START--> | ||
## :beers: Contributing | ||
Welcome contributing! | ||
Please use GitHub's Issues/PRs. | ||
### Development Tools | ||
- `yarn test` runs tests and measures coverage. | ||
- `yarn update` runs in order to update readme and recommended configuration. | ||
### Working With Rules | ||
This plugin uses [svelte-eslint-parser](https://github.com/ota-meshi/svelte-eslint-parser) for the parser. Check [here](https://ota-meshi.github.io/svelte-eslint-parser/) to find out about AST. | ||
<!--DOCS_IGNORE_END--> | ||
## :lock: License | ||
See the [LICENSE](LICENSE) file for license rights and limitations (MIT). | ||
[svelte]: https://svelte.dev/ | ||
[eslint]: https://eslint.org/ |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
379556
135
8370
0
349
10
66
2
+ Addeddebug@^4.3.1
+ Addedeslint-utils@^3.0.0
+ Addedknown-css-properties@^0.25.0
+ Addedpostcss@^8.4.5
+ Addedpostcss-load-config@^3.1.4
+ Addedpostcss-safe-parser@^6.0.0
+ Addedsourcemap-codec@^1.4.8
+ Addedsvelte-eslint-parser@^0.16.0
+ Added@eslint/eslintrc@2.1.4(transitive)
+ Added@eslint/js@8.57.1(transitive)
+ Added@humanwhocodes/config-array@0.13.0(transitive)
+ Added@humanwhocodes/object-schema@2.0.3(transitive)
+ Added@ungap/structured-clone@1.2.0(transitive)
+ Addeddoctrine@3.0.0(transitive)
+ Addedeslint@8.57.1(transitive)
+ Addedeslint-scope@7.2.2(transitive)
+ Addedeslint-utils@3.0.0(transitive)
+ Addedeslint-visitor-keys@2.1.0(transitive)
+ Addedespree@9.6.1(transitive)
+ Addedfile-entry-cache@6.0.1(transitive)
+ Addedflat-cache@3.2.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglobals@13.24.0(transitive)
+ Addedgraphemer@1.4.0(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedknown-css-properties@0.25.0(transitive)
+ Addedlilconfig@2.1.0(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpicocolors@1.1.0(transitive)
+ Addedpostcss@8.4.47(transitive)
+ Addedpostcss-load-config@3.1.4(transitive)
+ Addedpostcss-safe-parser@6.0.0(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedsourcemap-codec@1.4.8(transitive)
+ Addedsvelte-eslint-parser@0.16.6(transitive)
+ Addedtype-fest@0.20.2(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedyaml@1.10.2(transitive)
- Removedeslint-plugin-svelte3@^3.1.2
- Removed@eslint/config-array@0.18.0(transitive)
- Removed@eslint/eslintrc@3.1.0(transitive)
- Removed@eslint/js@9.10.0(transitive)
- Removed@eslint/object-schema@2.1.4(transitive)
- Removed@eslint/plugin-kit@0.1.0(transitive)
- Removed@humanwhocodes/retry@0.3.0(transitive)
- Removedeslint@9.10.0(transitive)
- Removedeslint-plugin-svelte3@3.4.1(transitive)
- Removedeslint-scope@8.0.2(transitive)
- Removedeslint-visitor-keys@4.0.0(transitive)
- Removedespree@10.1.0(transitive)
- Removedfile-entry-cache@8.0.0(transitive)
- Removedflat-cache@4.0.1(transitive)
- Removedglobals@14.0.0(transitive)