Skip to content

chore: fix web site #606

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 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion explorer-v2/build-system/pre-build/eslint.js

This file was deleted.

30 changes: 0 additions & 30 deletions explorer-v2/build-system/pre-build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,6 @@ const base = {
};
/** @type {import('webpack').Configuration[]} */
export default [
{
...base,
entry: {
eslint: resolve('./eslint.js')
},
externals: {
espree: '$$inject_espree$$',
esquery: '$$inject_esquery$$'
},
plugins: [
new WrapperPlugin({
test: /eslint\.js/,
header: `
if (typeof window !== "undefined") {
if (typeof window.global === "undefined") {
window.global = {}
}
if (typeof window.process === "undefined") {
window.process = {
env: {},
cwd: () => undefined,
}
}
}
import * as $$inject_espree$$ from 'espree';
import $$inject_esquery$$ from 'esquery';
`
})
]
},
{
...base,
entry: {
Expand Down
1 change: 1 addition & 0 deletions explorer-v2/build-system/shim/fast-glob.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
25 changes: 13 additions & 12 deletions explorer-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,27 @@
},
"dependencies": {
"@fontsource/fira-mono": "^5.1.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^9.0.0",
"@typescript-eslint/parser": "^8.16.0",
"eslint": "^9.16.0",
"eslint-scope": "^7.2.2",
"esquery": "^1.6.0",
"pako": "^2.1.0",
"svelte": "^5.0.0",
"svelte": "^5.2.12",
"svelte-eslint-parser": "link:..",
"tslib": "^2.7.0"
"tslib": "^2.8.1",
"vite-plugin-eslint4b": "^0.5.0"
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.7.0",
"@sveltejs/vite-plugin-svelte": "^5.0.0",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/kit": "^2.9.0",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"monaco-editor": "^0.52.0",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7",
"prettier": "^3.4.1",
"prettier-plugin-svelte": "^3.3.2",
"string-replace-loader": "^3.1.0",
"typescript": "^5.6.3",
"vite": "^6.0.0",
"webpack": "^5.95.0",
"typescript": "^5.7.2",
"vite": "^6.0.1",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"wrapper-webpack-plugin": "^2.2.2"
}
Expand Down
3 changes: 2 additions & 1 deletion explorer-v2/src/lib/ESLintEditor.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import { builtinRules } from 'eslint/use-at-your-own-risk';
import MonacoEditor from './MonacoEditor.svelte';
import { loadMonacoEditor } from './scripts/monaco-loader';
import { createEventDispatcher, onMount } from 'svelte';
Expand Down Expand Up @@ -64,7 +65,7 @@
/** message to marker */
async function messageToMarker(message, messageMap) {
const monaco = await loadMonacoEditor();
const rule = message.ruleId && linter.getRules().get(message.ruleId);
const rule = message.ruleId && builtinRules.get(message.ruleId);
const docUrl = rule && rule.meta && rule.meta.docs && rule.meta.docs.url;
const startLineNumber = ensurePositiveInt(message.line, 1);
const startColumn = ensurePositiveInt(message.column, 1);
Expand Down
24 changes: 13 additions & 11 deletions explorer-v2/src/lib/ESLintPlayground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import { onDestroy, onMount } from 'svelte';
import { Linter } from 'eslint';
import * as svelteEslintParser from 'svelte-eslint-parser';
import globals from 'globals';
import ESLintEditor from './ESLintEditor.svelte';
import RulesSettings from './RulesSettings.svelte';
import { deserializeState, serializeState } from './scripts/state';
import { DEFAULT_RULES_CONFIG, getURL } from './scripts/rules.js';

const linter = new Linter();
linter.defineParser('svelte-eslint-parser', svelteEslintParser);

const DEFAULT_CODE =
`<script>
Expand Down Expand Up @@ -115,17 +115,19 @@
{linter}
bind:code
config={{
parser: 'svelte-eslint-parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
parser: { ts: tsParser, typescript: tsParser }
languageOptions: {
parser: svelteEslintParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
parser: { ts: tsParser, typescript: tsParser }
},
globals: {
...globals.browser,
...globals.es2021
}
},
rules,
env: {
browser: true,
es2021: true
}
rules
}}
class="eslint-playground"
on:result={onLintedResult}
Expand Down
8 changes: 3 additions & 5 deletions explorer-v2/src/lib/scripts/rules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Linter } from 'eslint';

const linter = new Linter();
import { builtinRules } from 'eslint/use-at-your-own-risk';

export const categories = [
{
Expand All @@ -22,7 +20,7 @@ export const categories = [
export const DEFAULT_RULES_CONFIG = {};

const rules = [];
for (const [ruleId, rule] of linter.getRules()) {
for (const [ruleId, rule] of builtinRules) {
if (rule.meta.deprecated) {
continue;
}
Expand All @@ -41,5 +39,5 @@ for (const [ruleId, rule] of linter.getRules()) {
}
/** get url */
export function getURL(ruleId) {
return linter.getRules().get(ruleId)?.meta.docs.url ?? '';
return builtinRules.get(ruleId)?.meta.docs.url ?? '';
}
5 changes: 5 additions & 0 deletions explorer-v2/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<script>
import Header from '$lib/Header.svelte';
import '../app.css';
if (typeof window !== 'undefined') {
window.process = {
cwd: () => '/'
};
}
</script>

<Header />
Expand Down
7 changes: 5 additions & 2 deletions explorer-v2/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { resolve } from 'path';
import { createRequire } from 'module';
import eslint4b, { requireESLintUseAtYourOwnRisk4b } from 'vite-plugin-eslint4b';

const { version: MONACO_EDITOR_VERSION } = createRequire(import.meta.url)(
'monaco-editor/package.json'
);

/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()],
plugins: [sveltekit(), eslint4b(), requireESLintUseAtYourOwnRisk4b()],
server: {
fs: { strict: false }
},
resolve: {
alias: {
assert: resolve('./build-system/shim/assert.js'),
path: resolve('./build-system/shim/path.js'),
'node:path': resolve('./build-system/shim/path.js'),
util: resolve('./build-system/shim/util.js'),
fs: resolve('./build-system/shim/fs.js'),
module: resolve('./build-system/shim/module.js'),

globby: resolve('./build-system/shim/globby.js'),
'fast-glob': resolve('./build-system/shim/fast-glob.js'),
tslib: resolve('./node_modules/tslib/tslib.es6.js'),
eslint: resolve('./build-system/shim/eslint.js'),
'svelte-eslint-parser': resolve('./build-system/shim/svelte-eslint-parser.js'),
'svelte/compiler': resolve('./build-system/shim/svelte/compiler.js')
}
Expand Down
Loading