Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename package to eslint-plugin-svelte #160

Merged
merged 10 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install --legacy-peer-deps",
"postCreateCommand": "yarn install",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
Expand Down
13 changes: 3 additions & 10 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# These are supported funding model platforms

github: ota-meshi
# patreon: # Replace with a single Patreon username
# open_collective: # Replace with a single Open Collective username
# ko_fi: # Replace with a single Ko-fi username
# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
# liberapay: # Replace with a single Liberapay username
# issuehunt: # Replace with a single IssueHunt username
# otechie: # Replace with a single Otechie username
# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
github: [ota-meshi, JounQin]
open_collective: rxts
patreon: 1stG
6 changes: 3 additions & 3 deletions .github/workflows/GHPages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/setup-node@v3
- name: Install And Build
run: |+
npm install --legacy-peer-deps
npm run build
yarn install
yarn build
export NODE_OPTIONS="--max-old-space-size=8192"
npm run docs:build
yarn docs:build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Install Packages
run: npm install --legacy-peer-deps
run: yarn install
- name: Lint
run: npm run lint
run: |+
yarn build
yarn lint
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Install Packages
run: npm install --legacy-peer-deps
run: yarn install
- name: Build
run: |+
npm run update
npm run build
yarn update
yarn build
test:
name: "Test for ESLint ${{ matrix.eslint }} on ${{ matrix.node }} OS: ${{matrix.os}}"
runs-on: ${{ matrix.os }}
Expand All @@ -44,10 +46,10 @@ jobs:
node-version: ${{ matrix.node }}
- name: Install ESLint ${{ matrix.eslint }}
run: |+
npm i -D eslint@${{ matrix.eslint }} --legacy-peer-deps
npx rimraf node_modules
yarn add -D eslint@${{ matrix.eslint }} --ignore-engines
yarn run rimraf node_modules
JounQin marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.eslint != 8
- name: Install Packages
run: npm install --legacy-peer-deps
run: yarn install --ignore-engines
- name: Test
run: npm test
run: yarn test
28 changes: 0 additions & 28 deletions .github/workflows/NpmPublish.yml

This file was deleted.

104 changes: 54 additions & 50 deletions README.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions docs-svelte-kit/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line no-undef -- ignore
module.exports = {
extends: ["plugin:@ota-meshi/svelte/recommended"],
extends: ["plugin:svelte/recommended"],
env: {
browser: true,
es2022: true,
Expand All @@ -9,11 +9,11 @@ module.exports = {
sourceType: "module",
},
rules: {
"@ota-meshi/svelte/no-target-blank": "error",
"@ota-meshi/svelte/button-has-type": "error",
"@ota-meshi/svelte/no-useless-mustaches": "error",
"@ota-meshi/svelte/prefer-class-directive": "error",
"@ota-meshi/svelte/prefer-style-directive": "error",
"@ota-meshi/svelte/spaced-html-comment": "error",
"svelte/no-target-blank": "error",
"svelte/button-has-type": "error",
"svelte/no-useless-mustaches": "error",
"svelte/prefer-class-directive": "error",
"svelte/prefer-style-directive": "error",
"svelte/spaced-html-comment": "error",
},
}
2 changes: 1 addition & 1 deletion docs-svelte-kit/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
property="og:image"
content="https://ota-meshi.github.io/eslint-plugin-svelte/favicon.png"
/>
<meta property="og:site_name" content="@ota-meshi/eslint-plugin-svelte" />
<meta property="og:site_name" content="eslint-plugin-svelte" />
<meta
property="og:description"
content="ESLint plugin for Svelte using AST"
Expand Down
2 changes: 1 addition & 1 deletion docs-svelte-kit/src/lib/components/ESLintPlayground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
})

const DEFAULT_CODE =
`<!-- Welcome to @ota-meshi/eslint-plugin-svelte -->
`<!-- Welcome to eslint-plugin-svelte -->
<script>
let a = 1;
let b = 2;
Expand Down
2 changes: 1 addition & 1 deletion docs-svelte-kit/src/lib/header/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</ul>
<div class="nav-title">
<a sveltekit:prefetch href="{baseUrl}/">
<img src={logo} alt="Logo" />@ota-meshi/eslint-plugin-svelte</a
<img src={logo} alt="Logo" />eslint-plugin-svelte</a
>
</div>
<svg viewBox="0 0 2 3" aria-hidden="true">
Expand Down
2 changes: 2 additions & 0 deletions docs-svelte-kit/src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ const SIDE_MENU = {
children: categoryRules,
},
{ path: "/playground/", title: "Playground" },
{ path: "/migration/", title: "Migration" },
],
"/": [
{ path: "/", title: "Introduction" },
{ path: "/user-guide/", title: "User Guide" },
{ path: "/rules/", title: "Available Rules" },
{ path: "/playground/", title: "Playground" },
{ path: "/migration/", title: "Migration" },
],
}

Expand Down
2 changes: 1 addition & 1 deletion docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict"

module.exports = {
extends: ["plugin:@ota-meshi/svelte/recommended"],
extends: ["plugin:svelte/recommended"],
rules: {
"eslint-comments/require-description": "off",
"prettier/prettier": "off",
Expand Down
20 changes: 10 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
title: "@ota-meshi/eslint-plugin-svelte"
title: "eslint-plugin-svelte"
---

# Introduction

`@ota-meshi/eslint-plugin-svelte` is [ESLint] plugin for [Svelte].
`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](./playground.md).

[![NPM license](https://img.shields.io/npm/l/@ota-meshi/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/@ota-meshi/eslint-plugin-svelte)
[![NPM version](https://img.shields.io/npm/v/@ota-meshi/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/@ota-meshi/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/@ota-meshi/eslint-plugin-svelte&maxAge=3600)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte)
[![NPM downloads](https://img.shields.io/npm/dw/@ota-meshi/eslint-plugin-svelte.svg)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte)
[![NPM downloads](https://img.shields.io/npm/dm/@ota-meshi/eslint-plugin-svelte.svg)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte)
[![NPM downloads](https://img.shields.io/npm/dy/@ota-meshi/eslint-plugin-svelte.svg)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte)
[![NPM downloads](https://img.shields.io/npm/dt/@ota-meshi/eslint-plugin-svelte.svg)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte)
[![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)

## :name_badge: What is this plugin?
Expand All @@ -30,7 +30,7 @@ The [svelte-eslint-parser] aims to make it easy to create your own rules for the

### ❗ Attention

The [svelte-eslint-parser] and the `@ota-meshi/eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3].
The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3].

[svelte-eslint-parser]: https://github.com/ota-meshi/svelte-eslint-parser
[eslint-plugin-svelte3]: https://github.com/sveltejs/eslint-plugin-svelte3
Expand Down
55 changes: 55 additions & 0 deletions docs/migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Migration Guide

## From `eslint-plugin-svelte` v1 To v2

`eslint-plugin-svelte` v1 was an alias for [eslint-plugin-svelte3], but `eslint-plugin-svelte` v2 is now an independent eslint-plugin.

If you want the previous behavior, replace it with [eslint-plugin-svelte3].

[eslint-plugin-svelte3]: https://github.com/sveltejs/eslint-plugin-svelte3

## From `@ota-meshi/eslint-plugin-svelte`

`@ota-meshi/eslint-plugin-svelte` has been renamed to `eslint-plugin-svelte`.
Therefore, you need to replace the package name, and the presets, rules, and settings specified in the configuration.

- `package.json`
Replace the package name.

```diff
- "@ota-meshi/eslint-plugin-svelte": "^0.X.X"
+ "eslint-plugin-svelte": "^X.X.X"
```

- `.eslintrc.*`
Replace `@ota-meshi/svelte` with `svelte` as a string.
Examples:

- Presets

```diff
"extends": [
- "plugin:@ota-meshi/svelte/recommended"
+ "plugin:svelte/recommended"
],
```

- Rules

```diff
"rules": {
- "@ota-meshi/svelte/no-dupe-else-if-blocks": "error",
+ "svelte/no-dupe-else-if-blocks": "error",
- "@ota-meshi/svelte/button-has-type": "error",
+ "svelte/button-has-type": "error",
},
```

- `settings`

```diff
"settings": {
- "@ota-meshi/svelte": { ... }
+ "svelte": { ... }
},
```
58 changes: 29 additions & 29 deletions docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebarDepth: 0
# Available Rules

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 `plugin:@ota-meshi/svelte/recommended` config.
The rules with the following star :star: are included in the `plugin:svelte/recommended` config.

<!-- This file is automatically generated in tools/update-docs-rules-index.js, do not change! -->

Expand All @@ -15,66 +15,66 @@ These rules relate to possible syntax or logic errors in Svelte code:

| Rule ID | Description | |
|:--------|:------------|:---|
| [@ota-meshi/svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
| [@ota-meshi/svelte/no-dupe-style-properties](./rules/no-dupe-style-properties.md) | disallow duplicate style properties | :star: |
| [@ota-meshi/svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | disallow dynamic slot name | :star::wrench: |
| [@ota-meshi/svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | :star: |
| [@ota-meshi/svelte/no-object-in-text-mustaches](./rules/no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: |
| [@ota-meshi/svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: |
| [@ota-meshi/svelte/no-unknown-style-directive-property](./rules/no-unknown-style-directive-property.md) | disallow unknown `style:property` | :star: |
| [@ota-meshi/svelte/valid-compile](./rules/valid-compile.md) | disallow warnings when compiling. | :star: |
| [svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
| [svelte/no-dupe-style-properties](./rules/no-dupe-style-properties.md) | disallow duplicate style properties | :star: |
| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | disallow dynamic slot name | :star::wrench: |
| [svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | :star: |
| [svelte/no-object-in-text-mustaches](./rules/no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: |
| [svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: |
| [svelte/no-unknown-style-directive-property](./rules/no-unknown-style-directive-property.md) | disallow unknown `style:property` | :star: |
| [svelte/valid-compile](./rules/valid-compile.md) | disallow warnings when compiling. | :star: |

## Security Vulnerability

These rules relate to security vulnerabilities in Svelte code:

| Rule ID | Description | |
|:--------|:------------|:---|
| [@ota-meshi/svelte/no-at-html-tags](./rules/no-at-html-tags.md) | disallow use of `{@html}` to prevent XSS attack | :star: |
| [@ota-meshi/svelte/no-target-blank](./rules/no-target-blank.md) | disallow `target="_blank"` attribute without `rel="noopener noreferrer"` | |
| [svelte/no-at-html-tags](./rules/no-at-html-tags.md) | disallow use of `{@html}` to prevent XSS attack | :star: |
| [svelte/no-target-blank](./rules/no-target-blank.md) | 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 | |
|:--------|:------------|:---|
| [@ota-meshi/svelte/button-has-type](./rules/button-has-type.md) | disallow usage of button without an explicit type attribute | |
| [@ota-meshi/svelte/no-at-debug-tags](./rules/no-at-debug-tags.md) | disallow the use of `{@debug}` | :star: |
| [@ota-meshi/svelte/no-unused-svelte-ignore](./rules/no-unused-svelte-ignore.md) | disallow unused svelte-ignore comments | :star: |
| [@ota-meshi/svelte/no-useless-mustaches](./rules/no-useless-mustaches.md) | disallow unnecessary mustache interpolations | :wrench: |
| [@ota-meshi/svelte/require-optimized-style-attribute](./rules/require-optimized-style-attribute.md) | require style attributes that can be optimized | |
| [svelte/button-has-type](./rules/button-has-type.md) | disallow usage of button without an explicit type attribute | |
| [svelte/no-at-debug-tags](./rules/no-at-debug-tags.md) | disallow the use of `{@debug}` | :star: |
| [svelte/no-unused-svelte-ignore](./rules/no-unused-svelte-ignore.md) | disallow unused svelte-ignore comments | :star: |
| [svelte/no-useless-mustaches](./rules/no-useless-mustaches.md) | disallow unnecessary mustache interpolations | :wrench: |
| [svelte/require-optimized-style-attribute](./rules/require-optimized-style-attribute.md) | require style attributes that can be optimized | |

## Stylistic Issues

These rules relate to style guidelines, and are therefore quite subjective:

| Rule ID | Description | |
|:--------|:------------|:---|
| [@ota-meshi/svelte/first-attribute-linebreak](./rules/first-attribute-linebreak.md) | enforce the location of first attribute | :wrench: |
| [@ota-meshi/svelte/html-quotes](./rules/html-quotes.md) | enforce quotes style of HTML attributes | :wrench: |
| [@ota-meshi/svelte/indent](./rules/indent.md) | enforce consistent indentation | :wrench: |
| [@ota-meshi/svelte/max-attributes-per-line](./rules/max-attributes-per-line.md) | enforce the maximum number of attributes per line | :wrench: |
| [@ota-meshi/svelte/mustache-spacing](./rules/mustache-spacing.md) | enforce unified spacing in mustache | :wrench: |
| [@ota-meshi/svelte/prefer-class-directive](./rules/prefer-class-directive.md) | require class directives instead of ternary expressions | :wrench: |
| [@ota-meshi/svelte/prefer-style-directive](./rules/prefer-style-directive.md) | require style directives instead of style attribute | :wrench: |
| [@ota-meshi/svelte/shorthand-attribute](./rules/shorthand-attribute.md) | enforce use of shorthand syntax in attribute | :wrench: |
| [@ota-meshi/svelte/shorthand-directive](./rules/shorthand-directive.md) | enforce use of shorthand syntax in directives | :wrench: |
| [@ota-meshi/svelte/spaced-html-comment](./rules/spaced-html-comment.md) | enforce consistent spacing after the `<!--` and before the `-->` in a HTML comment | :wrench: |
| [svelte/first-attribute-linebreak](./rules/first-attribute-linebreak.md) | enforce the location of first attribute | :wrench: |
| [svelte/html-quotes](./rules/html-quotes.md) | enforce quotes style of HTML attributes | :wrench: |
| [svelte/indent](./rules/indent.md) | enforce consistent indentation | :wrench: |
| [svelte/max-attributes-per-line](./rules/max-attributes-per-line.md) | enforce the maximum number of attributes per line | :wrench: |
| [svelte/mustache-spacing](./rules/mustache-spacing.md) | enforce unified spacing in mustache | :wrench: |
| [svelte/prefer-class-directive](./rules/prefer-class-directive.md) | require class directives instead of ternary expressions | :wrench: |
| [svelte/prefer-style-directive](./rules/prefer-style-directive.md) | require style directives instead of style attribute | :wrench: |
| [svelte/shorthand-attribute](./rules/shorthand-attribute.md) | enforce use of shorthand syntax in attribute | :wrench: |
| [svelte/shorthand-directive](./rules/shorthand-directive.md) | enforce use of shorthand syntax in directives | :wrench: |
| [svelte/spaced-html-comment](./rules/spaced-html-comment.md) | 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 | |
|:--------|:------------|:---|
| [@ota-meshi/svelte/no-inner-declarations](./rules/no-inner-declarations.md) | disallow variable or `function` declarations in nested blocks | :star: |
| [svelte/no-inner-declarations](./rules/no-inner-declarations.md) | disallow variable or `function` declarations in nested blocks | :star: |

## System

These rules relate to this plugin works:

| Rule ID | Description | |
|:--------|:------------|:---|
| [@ota-meshi/svelte/comment-directive](./rules/comment-directive.md) | support comment-directives in HTML template | :star: |
| [@ota-meshi/svelte/system](./rules/system.md) | system rule for working this plugin | :star: |
| [svelte/comment-directive](./rules/comment-directive.md) | support comment-directives in HTML template | :star: |
| [svelte/system](./rules/system.md) | system rule for working this plugin | :star: |
Loading