Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
21
Frontend-Learner/node_modules/eslint-processor-vue-blocks/LICENSE
generated
vendored
Normal file
21
Frontend-Learner/node_modules/eslint-processor-vue-blocks/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 Anthony Fu <https://github.com/antfu>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
82
Frontend-Learner/node_modules/eslint-processor-vue-blocks/README.md
generated
vendored
Normal file
82
Frontend-Learner/node_modules/eslint-processor-vue-blocks/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# eslint-processor-vue-blocks
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![bundle][bundle-src]][bundle-href]
|
||||
[![JSDocs][jsdocs-src]][jsdocs-href]
|
||||
[![License][license-src]][license-href]
|
||||
|
||||
Create virtual files in ESLint for each Vue SFC block, so that you can lint them individually.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm i -D eslint-processor-vue-blocks eslint-merge-processors
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
In ESLint flat config:
|
||||
|
||||
```js
|
||||
// eslint.config.js
|
||||
import { mergeProcessors } from 'eslint-merge-processors'
|
||||
import pluginVue from 'eslint-plugin-vue'
|
||||
import processorVueBlocks from 'eslint-processor-vue-blocks'
|
||||
|
||||
export default [
|
||||
{
|
||||
files: ['*/*.vue'],
|
||||
plugins: {
|
||||
vue: pluginVue,
|
||||
},
|
||||
// `eslint-plugin-vue` will set a default processor for `.vue` files
|
||||
// we use `eslint-merge-processors` to extend it
|
||||
processor: mergeProcessors([
|
||||
pluginVue.processors['.vue'],
|
||||
processorVueBlocks({
|
||||
blocks: {
|
||||
styles: true,
|
||||
customBlocks: true,
|
||||
// Usually it's not recommended to lint <script> and <template>
|
||||
// As eslint-plugin-vue already provides the support
|
||||
script: false,
|
||||
template: false,
|
||||
}
|
||||
}),
|
||||
]),
|
||||
rules: {
|
||||
// ...
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.css'],
|
||||
// ... now you can lint CSS files as well as the <style> blocks in Vue SFCs
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Sponsors
|
||||
|
||||
<p align="center">
|
||||
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
|
||||
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)
|
||||
|
||||
<!-- Badges -->
|
||||
|
||||
[npm-version-src]: https://img.shields.io/npm/v/eslint-processor-vue-blocks?style=flat&colorA=080f12&colorB=1fa669
|
||||
[npm-version-href]: https://npmjs.com/package/eslint-processor-vue-blocks
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-processor-vue-blocks?style=flat&colorA=080f12&colorB=1fa669
|
||||
[npm-downloads-href]: https://npmjs.com/package/eslint-processor-vue-blocks
|
||||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/eslint-processor-vue-blocks?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
||||
[bundle-href]: https://bundlephobia.com/result?p=eslint-processor-vue-blocks
|
||||
[license-src]: https://img.shields.io/github/license/antfu/eslint-processor-vue-blocks.svg?style=flat&colorA=080f12&colorB=1fa669
|
||||
[license-href]: https://github.com/antfu/eslint-processor-vue-blocks/blob/main/LICENSE
|
||||
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
||||
[jsdocs-href]: https://www.jsdocs.io/package/eslint-processor-vue-blocks
|
||||
44
Frontend-Learner/node_modules/eslint-processor-vue-blocks/dist/index.d.mts
generated
vendored
Normal file
44
Frontend-Learner/node_modules/eslint-processor-vue-blocks/dist/index.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { Linter } from 'eslint';
|
||||
|
||||
interface Options {
|
||||
blocks?: {
|
||||
/**
|
||||
* Create virtual files for each `<style>` block
|
||||
* @default false
|
||||
*/
|
||||
styles?: boolean;
|
||||
/**
|
||||
* Enable custom blocks
|
||||
* Pass an string array to specify custom block types, or `true` to enable all custom blocks
|
||||
* @default false
|
||||
*/
|
||||
customBlocks?: boolean | string[];
|
||||
/**
|
||||
* Create virtual files for each `<template>` block
|
||||
* Generally not recommended, as `eslint-plugin-vue` handles it
|
||||
* @default false
|
||||
*/
|
||||
template?: boolean;
|
||||
/**
|
||||
* Create virtual files for each `<script>` block
|
||||
* Generally not recommended, as `eslint-plugin-vue` handles it
|
||||
* @default false
|
||||
*/
|
||||
script?: boolean;
|
||||
/**
|
||||
* Create virtual files for each `<script setup>` block
|
||||
* Generally not recommended, as `eslint-plugin-vue` handles it
|
||||
* @default false
|
||||
*/
|
||||
scriptSetup?: boolean;
|
||||
};
|
||||
/**
|
||||
* Default language for each block type
|
||||
*
|
||||
* @example { style: 'postcss', i18n: 'json' }
|
||||
*/
|
||||
defaultLanguage?: Record<string, string>;
|
||||
}
|
||||
declare function processor(options?: Options): Linter.Processor;
|
||||
|
||||
export { type Options, processor as default };
|
||||
44
Frontend-Learner/node_modules/eslint-processor-vue-blocks/dist/index.d.ts
generated
vendored
Normal file
44
Frontend-Learner/node_modules/eslint-processor-vue-blocks/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { Linter } from 'eslint';
|
||||
|
||||
interface Options {
|
||||
blocks?: {
|
||||
/**
|
||||
* Create virtual files for each `<style>` block
|
||||
* @default false
|
||||
*/
|
||||
styles?: boolean;
|
||||
/**
|
||||
* Enable custom blocks
|
||||
* Pass an string array to specify custom block types, or `true` to enable all custom blocks
|
||||
* @default false
|
||||
*/
|
||||
customBlocks?: boolean | string[];
|
||||
/**
|
||||
* Create virtual files for each `<template>` block
|
||||
* Generally not recommended, as `eslint-plugin-vue` handles it
|
||||
* @default false
|
||||
*/
|
||||
template?: boolean;
|
||||
/**
|
||||
* Create virtual files for each `<script>` block
|
||||
* Generally not recommended, as `eslint-plugin-vue` handles it
|
||||
* @default false
|
||||
*/
|
||||
script?: boolean;
|
||||
/**
|
||||
* Create virtual files for each `<script setup>` block
|
||||
* Generally not recommended, as `eslint-plugin-vue` handles it
|
||||
* @default false
|
||||
*/
|
||||
scriptSetup?: boolean;
|
||||
};
|
||||
/**
|
||||
* Default language for each block type
|
||||
*
|
||||
* @example { style: 'postcss', i18n: 'json' }
|
||||
*/
|
||||
defaultLanguage?: Record<string, string>;
|
||||
}
|
||||
declare function processor(options?: Options): Linter.Processor;
|
||||
|
||||
export { type Options, processor as default };
|
||||
116
Frontend-Learner/node_modules/eslint-processor-vue-blocks/dist/index.mjs
generated
vendored
Normal file
116
Frontend-Learner/node_modules/eslint-processor-vue-blocks/dist/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
import { parse } from '@vue/compiler-sfc';
|
||||
|
||||
class TextWrapper {
|
||||
constructor(text) {
|
||||
this.text = text;
|
||||
this.lines = text.split("\n");
|
||||
this.lines.forEach((_, index) => {
|
||||
if (index !== this.lines.length - 1)
|
||||
this.lines[index] += "\n";
|
||||
});
|
||||
this.linesLength = this.lines.map((line) => line.length);
|
||||
}
|
||||
lines;
|
||||
linesLength;
|
||||
getLineColumn(index) {
|
||||
let line = 0;
|
||||
while (index >= this.linesLength[line]) {
|
||||
index -= this.linesLength[line];
|
||||
line++;
|
||||
}
|
||||
return {
|
||||
line: line + 1,
|
||||
column: index
|
||||
};
|
||||
}
|
||||
getIndex(line, column) {
|
||||
return this.linesLength.slice(0, line - 1).reduce((a, b) => a + b, 0) + column;
|
||||
}
|
||||
}
|
||||
const cache = /* @__PURE__ */ new Map();
|
||||
function processor(options = {}) {
|
||||
return {
|
||||
meta: {
|
||||
name: "eslint-processor-vue-blocks"
|
||||
},
|
||||
supportsAutofix: true,
|
||||
preprocess(text, filename) {
|
||||
const { descriptor } = parse(text, {
|
||||
filename,
|
||||
pad: false
|
||||
});
|
||||
const defaultLanguage = {
|
||||
style: "css",
|
||||
template: "html",
|
||||
script: "js",
|
||||
i18n: "json",
|
||||
...options.defaultLanguage
|
||||
};
|
||||
const wrapper = new TextWrapper(text);
|
||||
const blocks = [];
|
||||
function pushBlock(block) {
|
||||
const lang = block.lang || defaultLanguage[block.type] || block.type;
|
||||
let startOffset = wrapper.getIndex(block.loc.start.line, block.loc.start.column);
|
||||
let content = block.content;
|
||||
content = content.replace(/^(\s*)/g, (match) => {
|
||||
startOffset += match.length;
|
||||
return "";
|
||||
});
|
||||
blocks.push({
|
||||
text: content,
|
||||
filename: `${block.type}.${lang}`,
|
||||
wrapper,
|
||||
startOffset
|
||||
});
|
||||
}
|
||||
if (options.blocks?.styles)
|
||||
descriptor.styles.forEach((style) => pushBlock(style));
|
||||
if (options.blocks?.customBlocks) {
|
||||
descriptor.customBlocks.forEach((block) => {
|
||||
if (Array.isArray(options.blocks?.customBlocks) && !options.blocks?.customBlocks.includes(block.type))
|
||||
return;
|
||||
pushBlock(block);
|
||||
});
|
||||
}
|
||||
if (options.blocks?.template && descriptor.template)
|
||||
pushBlock(descriptor.template);
|
||||
if (options.blocks?.script && descriptor.script)
|
||||
pushBlock(descriptor.script);
|
||||
if (options.blocks?.scriptSetup && descriptor.scriptSetup)
|
||||
pushBlock(descriptor.scriptSetup);
|
||||
cache.set(filename, blocks);
|
||||
return blocks;
|
||||
},
|
||||
postprocess(messages, filename) {
|
||||
const blocks = cache.get(filename);
|
||||
cache.delete(filename);
|
||||
return messages.flatMap((blockMessages, index) => {
|
||||
const block = blocks[index];
|
||||
const startOffset = block.startOffset;
|
||||
const localLineColumn = new TextWrapper(block.text);
|
||||
function rewriteMessage(message) {
|
||||
const start = block.wrapper.getLineColumn(
|
||||
startOffset + localLineColumn.getIndex(message.line, message.column)
|
||||
);
|
||||
const end = block.wrapper.getLineColumn(
|
||||
startOffset + localLineColumn.getIndex(message.endLine, message.endColumn)
|
||||
);
|
||||
return {
|
||||
...message,
|
||||
line: start.line,
|
||||
column: start.column,
|
||||
endLine: end.line,
|
||||
endColumn: end.column,
|
||||
fix: message.fix && {
|
||||
...message.fix,
|
||||
range: message.fix.range.map((i) => i + startOffset - 1)
|
||||
}
|
||||
};
|
||||
}
|
||||
return blockMessages.map((message) => rewriteMessage(message));
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export { processor as default };
|
||||
84
Frontend-Learner/node_modules/eslint-processor-vue-blocks/package.json
generated
vendored
Normal file
84
Frontend-Learner/node_modules/eslint-processor-vue-blocks/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
"name": "eslint-processor-vue-blocks",
|
||||
"type": "module",
|
||||
"version": "2.0.0",
|
||||
"packageManager": "pnpm@10.2.1",
|
||||
"description": "Create virtual files in ESLint for each Vue SFC block, so that you can lint them individually.",
|
||||
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/antfu",
|
||||
"homepage": "https://github.com/antfu/eslint-processor-vue-blocks#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/antfu/eslint-processor-vue-blocks.git"
|
||||
},
|
||||
"bugs": "https://github.com/antfu/eslint-processor-vue-blocks/issues",
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslint-processor",
|
||||
"vue"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": "./dist/index.mjs"
|
||||
},
|
||||
"main": "./dist/index.mjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.mts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"*": [
|
||||
"./dist/*",
|
||||
"./dist/index.d.mts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"stub": "unbuild --stub",
|
||||
"lint": "eslint .",
|
||||
"prepublishOnly": "nr build",
|
||||
"release": "bumpp && npm publish",
|
||||
"start": "tsx src/index.ts",
|
||||
"test": "vitest",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"prepare": "simple-git-hooks"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/compiler-sfc": "^3.3.0",
|
||||
"eslint": ">=9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^4.1.1",
|
||||
"@antfu/ni": "^23.3.1",
|
||||
"@antfu/utils": "^8.1.0",
|
||||
"@types/eslint": "^9.6.1",
|
||||
"@types/node": "^22.13.1",
|
||||
"@vue/compiler-sfc": "^3.5.13",
|
||||
"bumpp": "^10.0.2",
|
||||
"eslint": "^9.20.0",
|
||||
"eslint-merge-processors": "^2.0.0",
|
||||
"eslint-plugin-format": "^1.0.1",
|
||||
"eslint-plugin-vue": "^9.32.0",
|
||||
"eslint-processor-vue-blocks": "workspace:*",
|
||||
"lint-staged": "^15.4.3",
|
||||
"pnpm": "^10.2.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"simple-git-hooks": "^2.11.1",
|
||||
"tsx": "^4.19.2",
|
||||
"typescript": "^5.7.3",
|
||||
"unbuild": "^3.3.1",
|
||||
"vite": "^6.1.0",
|
||||
"vitest": "^3.0.5",
|
||||
"vue": "^3.5.13"
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
"pre-commit": "pnpm lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "eslint --fix"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue