Skip to content

ci: enable CI tools and linters #220

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

Merged
merged 2 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends @1stg/browserslist-config/modern
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "ota-meshi/eslint-plugin-svelte"
}
],
"commit": false,
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
4 changes: 4 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"node": "16",
"sandboxes": []
}
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@1stg"
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
/build
/docs-svelte-kit/shim/eslint.mjs
/docs-svelte-kit/shim/assert.mjs
!/.*.js
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports = {
"plugin:@ota-meshi/+eslint-plugin",
"plugin:@ota-meshi/+package-json",
"plugin:@ota-meshi/+json",
"plugin:@ota-meshi/+yaml",
"plugin:@ota-meshi/+md",
"plugin:@ota-meshi/+yaml",
"plugin:@ota-meshi/+prettier",
],
rules: {
Expand All @@ -35,6 +35,13 @@ module.exports = {
],
},
overrides: [
{
files: ["*.md"],
extends: "plugin:mdx/recommended",
settings: {
"mdx/code-blocks": true,
},
},
{
files: ["*.mjs"],
parserOptions: {
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ jobs:
run: yarn install --ignore-engines
- name: Test
run: yarn test
- name: Type Coverage
run: yarn typecov
37 changes: 37 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install Dependencies
run: yarn

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
commit: "chore: release eslint-plugin-svelte"
title: "chore: release eslint-plugin-svelte"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ dist
/yarn.lock
/lib
/.svelte-kit
/.type-coverage
/build
/svelte.config-dist.js
/docs-svelte-kit/shim/eslint.mjs
Expand Down
7 changes: 7 additions & 0 deletions .remarkrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"plugins": [
"@1stg/remark-config",
["lint-final-definition", false],
["lint-no-shortcut-reference-link", false]
]
}
15 changes: 15 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.*ignore
.npmrc
LICENSE
*.png
*.json
*.lock
*.log
*.svg
*.yaml
*.yml
/tests/fixtures/rules
# TODO: enable the following
# should we ignore markdown files?
*.md
/docs-svelte-kit/
119 changes: 61 additions & 58 deletions README.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ title: "eslint-plugin-svelte"

# Introduction

`eslint-plugin-svelte` is [ESLint] plugin for [Svelte].
It provides many unique check rules by using the template AST.
`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/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/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?
## :name\_badge: What is this plugin?

[ESLint] plugin for [Svelte].
[ESLint] plugin for [Svelte].\
It provides many unique check rules using the AST generated by [svelte-eslint-parser].

### ❓ Why?
Expand All @@ -39,7 +39,7 @@ The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with t

See [User Guide](./user-guide.md).

## :white_check_mark: Rules
## :white\_check\_mark: Rules

See [Available Rules](./rules.md).

Expand Down
8 changes: 4 additions & 4 deletions docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ If you want the previous behavior, replace it with [eslint-plugin-svelte3].

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

`@ota-meshi/eslint-plugin-svelte` has been renamed to `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`
- `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.
- `.eslintrc.*`\
Replace `@ota-meshi/svelte` with `svelte` as a string.\
Examples:

- Presets
Expand Down
1 change: 1 addition & 0 deletions docs/rules/first-attribute-linebreak.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This rule aims to enforce a consistent location for the first attribute.
<ESLintCodeBlock fix>

<!-- prettier-ignore-start -->

<!--eslint-skip-->

```svelte
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-extra-reactive-curlies.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Nothing.

## :heart: Compatibility

This rule was taken from [@tivac/eslint-plugin-svelte].
This rule was taken from [@tivac/eslint-plugin-svelte].\
This rule is compatible with `@tivac/svelte/reactive-curlies` rule.

[@tivac/eslint-plugin-svelte]: https://github.com/tivac/eslint-plugin-svelte/
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-inner-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ since: "v0.0.8"

This rule requires that function declarations and, optionally, variable declarations be in the root of a program or the body of a function.

This rule extends the base ESLint's [no-inner-declarations] rule. The AST generated by [svelte-eslint-parser] will false positives in [no-inner-declarations] rule because the root node of the script is not the `Program`.
This rule extends the base ESLint's [no-inner-declarations] rule. The AST generated by [svelte-eslint-parser] will false positives in [no-inner-declarations] rule because the root node of the script is not the `Program`.\
This rule supports [svelte-eslint-parser]'s AST.

[svelte-eslint-parser]: https://github.com/ota-meshi/svelte-eslint-parser
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-not-function-handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ since: "v0.5.0"

## :book: Rule Details

This rule reports where you used not function value in event handlers.
This rule reports where you used not function value in event handlers.\
If you use a non-function value for the event handler, it event handler will not be called. It's almost always a mistake. You may have written a lot of unnecessary curly braces.

<ESLintCodeBlock>
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-object-in-text-mustaches.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ since: "v0.5.0"

## :book: Rule Details

This rule disallows the use of objects in text mustache interpolation.
This rule disallows the use of objects in text mustache interpolation.\
When you use an object for text interpolation, it is drawn as `[object Object]`. It's almost always a mistake. You may have written a lot of unnecessary curly braces.

<ESLintCodeBlock>
Expand Down
3 changes: 2 additions & 1 deletion docs/rules/no-reactive-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ Nothing

## :heart: Compatibility

This rule was taken from [@tivac/eslint-plugin-svelte].
This rule was taken from [@tivac/eslint-plugin-svelte].\
This rule is compatible with `@tivac/svelte/reactive-functions` rule.

[@tivac/eslint-plugin-svelte]: https://github.com/tivac/eslint-plugin-svelte/

## :rocket: Version

This rule was introduced in eslint-plugin-svelte v2.5.0
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-reactive-literals.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Nothing.

## :heart: Compatibility

This rule was taken from [@tivac/eslint-plugin-svelte].
This rule was taken from [@tivac/eslint-plugin-svelte].\
This rule is compatible with `@tivac/svelte/reactive-literals` rule.

[@tivac/eslint-plugin-svelte]: https://github.com/tivac/eslint-plugin-svelte/
Expand Down
1 change: 1 addition & 0 deletions docs/rules/prefer-style-directive.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Style directive were added in Svelte v3.46.
<ESLintCodeBlock fix>

<!-- prettier-ignore-start -->

<!--eslint-skip-->

```svelte
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/require-stores-init.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Nothing.

## :heart: Compatibility

This rule was taken from [@tivac/eslint-plugin-svelte].
This rule was taken from [@tivac/eslint-plugin-svelte].\
This rule is compatible with `@tivac/svelte/stores-initial-value` rule.

[@tivac/eslint-plugin-svelte]: https://github.com/tivac/eslint-plugin-svelte/
Expand Down
1 change: 1 addition & 0 deletions docs/rules/shorthand-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This rule enforces the use of the shorthand syntax in attribute.
<ESLintCodeBlock fix>

<!-- prettier-ignore-start -->

<!--eslint-skip-->

```svelte
Expand Down
1 change: 1 addition & 0 deletions docs/rules/shorthand-directive.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This rule enforces the use of the shorthand syntax in directives.
<ESLintCodeBlock fix>

<!-- prettier-ignore-start -->

<!--eslint-skip-->

```svelte
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/spaced-html-comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You cannot enforce this style by using [prettier-plugin-svelte]. That is, this r
```

- `"always"` ... There must be at least one whitespace after `<!--` and before `-->`.
- `"never"` ... There should be no leading or trailing whitespace.  There should be no whitespace following.
- `"never"` ... There should be no leading or trailing whitespace. There should be no whitespace following.

## :rocket: Version

Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ npm install --save-dev eslint eslint-plugin-svelte svelte

### Configuration

Use `.eslintrc.*` file to configure rules. See also: [https://eslint.org/docs/user-guide/configuring](https://eslint.org/docs/user-guide/configuring).
Use `.eslintrc.*` file to configure rules. See also: <https://eslint.org/docs/user-guide/configuring>.

Example **.eslintrc.js**:

Expand Down Expand Up @@ -134,13 +134,13 @@ module.exports = {
}
```

See also [https://github.com/ota-meshi/svelte-eslint-parser#readme](https://github.com/ota-meshi/svelte-eslint-parser#readme).
See also <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.
- `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](./rules/valid-compile.md) and [svelte/no-unused-svelte-ignore](./rules/no-unused-svelte-ignore.md). **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`.
Expand Down
3 changes: 3 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict"

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