Skip to content

Commit 5da6c73

Browse files
authored
Replace website with sveltekit (#79)
* Replace website with sveltekit * update wf * Update style * update docs * update paths * site * update * update * update * update
1 parent 1781553 commit 5da6c73

File tree

90 files changed

+3296
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3296
-223
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@
1111
/tests/fixtures/rules/indent/invalid/ts-v5
1212
/tests/fixtures/rules/valid-compile/invalid/ts
1313
/tests/fixtures/rules/valid-compile/valid/ts
14+
/.svelte-kit
15+
/svelte.config-dist.js
16+
/build
17+
/docs-svelte-kit/shim/eslint.mjs
18+
/docs-svelte-kit/shim/assert.mjs

.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ module.exports = {
3535
],
3636
},
3737
overrides: [
38+
{
39+
files: ["*.mjs"],
40+
parserOptions: {
41+
sourceType: "module",
42+
},
43+
},
3844
{
3945
files: ["*.svelte"],
4046
parser: "svelte-eslint-parser",

.github/workflows/GHPages.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: GHPages
22

33
on:
4+
workflow_dispatch: null
45
push:
56
branches: [main]
67

@@ -12,12 +13,12 @@ jobs:
1213
- uses: actions/setup-node@v2
1314
- name: Install And Build
1415
run: |+
15-
npm install
16+
npm install --legacy-peer-deps
1617
npm run build
1718
npm run docs:build
1819
- name: Deploy
1920
uses: peaceiris/actions-gh-pages@v3
2021
with:
2122
github_token: ${{ secrets.GITHUB_TOKEN }}
22-
publish_dir: ./docs/.vuepress/dist
23+
publish_dir: ./build
2324
force_orphan: true

.github/workflows/NpmPublish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
with:
1616
registry-url: "https://registry.npmjs.org"
1717
- name: Install Packages
18-
run: npm install
18+
run: npm install --legacy-peer-deps
1919
- name: test and build
2020
run: |
2121
npm run build

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,8 @@ dist
105105

106106
## repo
107107
/lib
108+
/.svelte-kit
109+
/build
110+
/svelte.config-dist.js
111+
/docs-svelte-kit/shim/eslint.mjs
112+
/docs-svelte-kit/shim/assert.mjs

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
"editor.codeActionsOnSave": {
1717
"source.fixAll": true,
1818
"source.fixAll.stylelint": true
19-
}
19+
},
20+
"svelte.plugin.typescript.diagnostics.enable": false
2021
}

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`@ota-meshi/eslint-plugin-svelte` is ESLint plugin for Svelte.
44
It provides many unique check rules by using the template AST.
5-
You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-svelte/playground/).
5+
You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-svelte/playground).
66

77
::: **_WORKS IN PROGRESS_** :::
88

@@ -85,7 +85,7 @@ This plugin provides configs:
8585
- `plugin:@ota-meshi/svelte/base` ... Configuration to enable correct Svelte parsing.
8686
- `plugin:@ota-meshi/svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior.
8787

88-
See [the rule list](https://ota-meshi.github.io/eslint-plugin-svelte/rules/) to get the `rules` that this plugin provides.
88+
See [the rule list](https://ota-meshi.github.io/eslint-plugin-svelte/rules) to get the `rules` that this plugin provides.
8989

9090
::: warning ❗ Attention
9191

@@ -247,62 +247,62 @@ These rules relate to possible syntax or logic errors in Svelte code:
247247

248248
| Rule ID | Description | |
249249
|:--------|:------------|:---|
250-
| [@ota-meshi/svelte/no-dupe-else-if-blocks](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-else-if-blocks.html) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
251-
| [@ota-meshi/svelte/no-dynamic-slot-name](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name.html) | disallow dynamic slot name | :star::wrench: |
252-
| [@ota-meshi/svelte/no-not-function-handler](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-not-function-handler.html) | disallow use of not function in event handler | :star: |
253-
| [@ota-meshi/svelte/no-object-in-text-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches.html) | disallow objects in text mustache interpolation | :star: |
254-
| [@ota-meshi/svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile.html) | disallow warnings when compiling. | :star: |
250+
| [@ota-meshi/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: |
251+
| [@ota-meshi/svelte/no-dynamic-slot-name](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name) | disallow dynamic slot name | :star::wrench: |
252+
| [@ota-meshi/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: |
253+
| [@ota-meshi/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: |
254+
| [@ota-meshi/svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile) | disallow warnings when compiling. | :star: |
255255

256256
## Security Vulnerability
257257

258258
These rules relate to security vulnerabilities in Svelte code:
259259

260260
| Rule ID | Description | |
261261
|:--------|:------------|:---|
262-
| [@ota-meshi/svelte/no-at-html-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-html-tags.html) | disallow use of `{@html}` to prevent XSS attack | :star: |
263-
| [@ota-meshi/svelte/no-target-blank](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-target-blank.html) | disallow `target="_blank"` attribute without `rel="noopener noreferrer"` | |
262+
| [@ota-meshi/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: |
263+
| [@ota-meshi/svelte/no-target-blank](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-target-blank) | disallow `target="_blank"` attribute without `rel="noopener noreferrer"` | |
264264

265265
## Best Practices
266266

267267
These rules relate to better ways of doing things to help you avoid problems:
268268

269269
| Rule ID | Description | |
270270
|:--------|:------------|:---|
271-
| [@ota-meshi/svelte/button-has-type](https://ota-meshi.github.io/eslint-plugin-svelte/rules/button-has-type.html) | disallow usage of button without an explicit type attribute | |
272-
| [@ota-meshi/svelte/no-at-debug-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-debug-tags.html) | disallow the use of `{@debug}` | :star: |
273-
| [@ota-meshi/svelte/no-useless-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-useless-mustaches.html) | disallow unnecessary mustache interpolations | :wrench: |
271+
| [@ota-meshi/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 | |
272+
| [@ota-meshi/svelte/no-at-debug-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-debug-tags) | disallow the use of `{@debug}` | :star: |
273+
| [@ota-meshi/svelte/no-useless-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-useless-mustaches) | disallow unnecessary mustache interpolations | :wrench: |
274274

275275
## Stylistic Issues
276276

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

279279
| Rule ID | Description | |
280280
|:--------|:------------|:---|
281-
| [@ota-meshi/svelte/first-attribute-linebreak](https://ota-meshi.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak.html) | enforce the location of first attribute | :wrench: |
282-
| [@ota-meshi/svelte/html-quotes](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-quotes.html) | enforce quotes style of HTML attributes | :wrench: |
283-
| [@ota-meshi/svelte/indent](https://ota-meshi.github.io/eslint-plugin-svelte/rules/indent.html) | enforce consistent indentation | :wrench: |
284-
| [@ota-meshi/svelte/max-attributes-per-line](https://ota-meshi.github.io/eslint-plugin-svelte/rules/max-attributes-per-line.html) | enforce the maximum number of attributes per line | :wrench: |
285-
| [@ota-meshi/svelte/mustache-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/mustache-spacing.html) | enforce unified spacing in mustache | :wrench: |
286-
| [@ota-meshi/svelte/prefer-class-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-class-directive.html) | require class directives instead of ternary expressions | :wrench: |
287-
| [@ota-meshi/svelte/shorthand-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-attribute.html) | enforce use of shorthand syntax in attribute | :wrench: |
288-
| [@ota-meshi/svelte/spaced-html-comment](https://ota-meshi.github.io/eslint-plugin-svelte/rules/spaced-html-comment.html) | enforce consistent spacing after the `<!--` and before the `-->` in a HTML comment | :wrench: |
281+
| [@ota-meshi/svelte/first-attribute-linebreak](https://ota-meshi.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak) | enforce the location of first attribute | :wrench: |
282+
| [@ota-meshi/svelte/html-quotes](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-quotes) | enforce quotes style of HTML attributes | :wrench: |
283+
| [@ota-meshi/svelte/indent](https://ota-meshi.github.io/eslint-plugin-svelte/rules/indent) | enforce consistent indentation | :wrench: |
284+
| [@ota-meshi/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: |
285+
| [@ota-meshi/svelte/mustache-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/mustache-spacing) | enforce unified spacing in mustache | :wrench: |
286+
| [@ota-meshi/svelte/prefer-class-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-class-directive) | require class directives instead of ternary expressions | :wrench: |
287+
| [@ota-meshi/svelte/shorthand-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-attribute) | enforce use of shorthand syntax in attribute | :wrench: |
288+
| [@ota-meshi/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: |
289289

290290
## Extension Rules
291291

292292
These rules extend the rules provided by ESLint itself to work well in Svelte:
293293

294294
| Rule ID | Description | |
295295
|:--------|:------------|:---|
296-
| [@ota-meshi/svelte/no-inner-declarations](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-inner-declarations.html) | disallow variable or `function` declarations in nested blocks | :star: |
296+
| [@ota-meshi/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: |
297297

298298
## System
299299

300300
These rules relate to this plugin works:
301301

302302
| Rule ID | Description | |
303303
|:--------|:------------|:---|
304-
| [@ota-meshi/svelte/comment-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/comment-directive.html) | support comment-directives in HTML template | :star: |
305-
| [@ota-meshi/svelte/system](https://ota-meshi.github.io/eslint-plugin-svelte/rules/system.html) | system rule for working this plugin | :star: |
304+
| [@ota-meshi/svelte/comment-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/comment-directive) | support comment-directives in HTML template | :star: |
305+
| [@ota-meshi/svelte/system](https://ota-meshi.github.io/eslint-plugin-svelte/rules/system) | system rule for working this plugin | :star: |
306306

307307
<!--RULES_TABLE_END-->
308308
<!--RULES_SECTION_END-->

docs-svelte-kit/.eslintrc.cjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// eslint-disable-next-line no-undef -- ignore
2+
module.exports = {
3+
extends: ["plugin:@ota-meshi/svelte/recommended"],
4+
parserOptions: {
5+
sourceType: "module",
6+
},
7+
}

docs-svelte-kit/build-system/build.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
const esbuild = require("esbuild")
2+
const path = require("path")
3+
const fs = require("fs")
4+
// const babelCore = require("@babel/core")
5+
// const t = require("@babel/types")
6+
7+
build(
8+
require.resolve("./src/eslint.mjs"),
9+
path.join(__dirname, "../shim/eslint.mjs"),
10+
["assert"],
11+
)
12+
build(
13+
require.resolve("../../node_modules/assert"),
14+
path.join(__dirname, "../shim/assert.mjs"),
15+
)
16+
17+
/** build */
18+
function build(input, out, injects = []) {
19+
console.log(`build@ ${input}`)
20+
let code = bundle(input, injects)
21+
code = transform(code, injects)
22+
fs.writeFileSync(out, code, "utf8")
23+
}
24+
25+
/** bundle */
26+
function bundle(entryPoint, externals) {
27+
const result = esbuild.buildSync({
28+
entryPoints: [entryPoint],
29+
format: "esm",
30+
bundle: true,
31+
external: ["path", ...externals],
32+
write: false,
33+
})
34+
35+
return `${result.outputFiles[0].text}`
36+
}
37+
38+
/** transform code */
39+
function transform(code, injects) {
40+
// const newCode = babelCore.transformSync(code, {
41+
// babelrc: false,
42+
// plugins: [
43+
// {
44+
// visitor: {
45+
// CallExpression(path) {
46+
// const callee = path.get("callee")
47+
// if (
48+
// callee.type === "Identifier" &&
49+
// callee.node.name === "__require"
50+
// ) {
51+
// callee.replaceWith(t.identifier("__$$$require"))
52+
// }
53+
// },
54+
// },
55+
// },
56+
// ],
57+
// })
58+
return `
59+
${injects
60+
.map((inject) => `import $inject_${inject}$ from '${inject}';`)
61+
.join("\n")}
62+
const $_injects_$ = {${injects
63+
.map((inject) => `${inject}:$inject_${inject}$`)
64+
.join(",\n")}};
65+
const process = {
66+
env: {},
67+
cwd: () => undefined,
68+
}
69+
function require(module, ...args) {
70+
return $_injects_$[module] || {}
71+
}
72+
${code}
73+
`
74+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* eslint require-jsdoc:0 -- shim */
2+
3+
import * as all from "../../../node_modules/eslint/lib/linter/linter.js"
4+
const Linter = all.Linter
5+
export { Linter }
6+
export default { Linter }

docs-svelte-kit/shim/module.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* eslint require-jsdoc:0 -- shim */
2+
function createRequire() {
3+
return () => null
4+
}
5+
6+
export { createRequire }
7+
export default { createRequire }

docs-svelte-kit/shim/os.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* eslint require-jsdoc:0 -- shim */
2+
function platform() {
3+
return ""
4+
}
5+
6+
export { platform }
7+
export default { platform }

docs-svelte-kit/shim/path.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* eslint require-jsdoc:0 -- shim */
2+
3+
function dirname(p) {
4+
return p.split("/").slice(0, -1).join("/") || p
5+
}
6+
7+
const posix = { dirname }
8+
posix.posix = posix
9+
export { dirname, posix }
10+
export default posix

docs-svelte-kit/shim/url.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* eslint require-jsdoc:0 -- shim */
2+
function fileURLToPath(p) {
3+
return p
4+
}
5+
6+
export { fileURLToPath }
7+
export default { fileURLToPath }

docs-svelte-kit/src/.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
parserOptions: {
3+
sourceType: "module",
4+
},
5+
rules: {
6+
"node/no-unsupported-features/es-syntax": "off",
7+
"require-jsdoc": "off",
8+
},
9+
}

0 commit comments

Comments
 (0)