added eslint for astro

pull/5026/head
Daniel 2023-04-03 18:10:02 +05:30
parent c8869e768b
commit 93a77bb56e
8 changed files with 146 additions and 20 deletions

View File

@ -100,6 +100,20 @@
"never"
]
}
},
{
"files": ["src/config/**"],
"env": {
"browser": false,
"node": true
},
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-console": "off",
"unicorn/prefer-top-level-await": "off"
}
}
]
}

103
package-lock.json generated
View File

@ -22,6 +22,7 @@
"eslint": "^8.36.0",
"eslint-config-xo": "^0.43.1",
"eslint-config-xo-typescript": "^0.56.0",
"eslint-plugin-astro": "^0.26.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-unicorn": "^46.0.0",
"fs-extra": "^11.1.1",
@ -2043,6 +2044,28 @@
}
}
},
"node_modules/astro-eslint-parser": {
"version": "0.13.2",
"resolved": "https://registry.npmjs.org/astro-eslint-parser/-/astro-eslint-parser-0.13.2.tgz",
"integrity": "sha512-hLCfc4IfeR550tCxEQDOnoDbf+B7CtU3he0foNQ+XxfYyx+8qKwcEIvigrU1PzfwAfAvT83RFA1Q6TWHDj82GA==",
"dev": true,
"dependencies": {
"@astrojs/compiler": "^1.0.0",
"@typescript-eslint/scope-manager": "^5.48.2",
"@typescript-eslint/types": "^5.25.0",
"astrojs-compiler-sync": "^0.3.0",
"debug": "^4.3.4",
"eslint-visitor-keys": "^3.0.0",
"espree": "^9.0.0",
"semver": "^7.3.8"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ota-meshi"
}
},
"node_modules/astro/node_modules/ansi-regex": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
@ -2144,6 +2167,24 @@
"node": ">=12"
}
},
"node_modules/astrojs-compiler-sync": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/astrojs-compiler-sync/-/astrojs-compiler-sync-0.3.2.tgz",
"integrity": "sha512-q/8Z30WNpsktLKS5NdT/6QAF9Q/C4ucLldqUpHgvRhuj/6jkJyOQfapQxkTKp8MK4RjH9sSsClfrTIdk8JZlKw==",
"dev": true,
"dependencies": {
"synckit": "^0.8.0"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ota-meshi"
},
"peerDependencies": {
"@astrojs/compiler": ">=0.27.0"
}
},
"node_modules/autoprefixer": {
"version": "10.4.14",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz",
@ -3570,6 +3611,29 @@
"ms": "^2.1.1"
}
},
"node_modules/eslint-plugin-astro": {
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-astro/-/eslint-plugin-astro-0.26.1.tgz",
"integrity": "sha512-FEZOrOQ5ahenbwjKz5LYJpeOZUggDM54idrq5bTJdL4GsXy1xx2eyKy5UjGhh8NwddowCCPqfDHFfDz9oNj/ew==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@jridgewell/sourcemap-codec": "^1.4.14",
"@typescript-eslint/types": "^5.25.0",
"astro-eslint-parser": "^0.13.1",
"postcss": "^8.4.14",
"postcss-selector-parser": "^6.0.10"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ota-meshi"
},
"peerDependencies": {
"eslint": ">=7.0.0"
}
},
"node_modules/eslint-plugin-import": {
"version": "2.27.5",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",
@ -11661,6 +11725,31 @@
}
}
},
"astro-eslint-parser": {
"version": "0.13.2",
"resolved": "https://registry.npmjs.org/astro-eslint-parser/-/astro-eslint-parser-0.13.2.tgz",
"integrity": "sha512-hLCfc4IfeR550tCxEQDOnoDbf+B7CtU3he0foNQ+XxfYyx+8qKwcEIvigrU1PzfwAfAvT83RFA1Q6TWHDj82GA==",
"dev": true,
"requires": {
"@astrojs/compiler": "^1.0.0",
"@typescript-eslint/scope-manager": "^5.48.2",
"@typescript-eslint/types": "^5.25.0",
"astrojs-compiler-sync": "^0.3.0",
"debug": "^4.3.4",
"eslint-visitor-keys": "^3.0.0",
"espree": "^9.0.0",
"semver": "^7.3.8"
}
},
"astrojs-compiler-sync": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/astrojs-compiler-sync/-/astrojs-compiler-sync-0.3.2.tgz",
"integrity": "sha512-q/8Z30WNpsktLKS5NdT/6QAF9Q/C4ucLldqUpHgvRhuj/6jkJyOQfapQxkTKp8MK4RjH9sSsClfrTIdk8JZlKw==",
"dev": true,
"requires": {
"synckit": "^0.8.0"
}
},
"autoprefixer": {
"version": "10.4.14",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz",
@ -12683,6 +12772,20 @@
}
}
},
"eslint-plugin-astro": {
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-astro/-/eslint-plugin-astro-0.26.1.tgz",
"integrity": "sha512-FEZOrOQ5ahenbwjKz5LYJpeOZUggDM54idrq5bTJdL4GsXy1xx2eyKy5UjGhh8NwddowCCPqfDHFfDz9oNj/ew==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.2.0",
"@jridgewell/sourcemap-codec": "^1.4.14",
"@typescript-eslint/types": "^5.25.0",
"astro-eslint-parser": "^0.13.1",
"postcss": "^8.4.14",
"postcss-selector-parser": "^6.0.10"
}
},
"eslint-plugin-import": {
"version": "2.27.5",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",

View File

@ -5,7 +5,6 @@
"license": "MIT",
"author": "Colorlib <https://colorlib.com>",
"main": "dist/js/adminlte.min.js",
"types": "dist/js/types/adminlte.d.ts",
"scripts": {
"dev": "npm-run-all --parallel watch docs-serve",
"css": "npm-run-all css-compile css-prefix css-rtl css-minify",
@ -70,6 +69,7 @@
"eslint": "^8.36.0",
"eslint-config-xo": "^0.43.1",
"eslint-config-xo-typescript": "^0.56.0",
"eslint-plugin-astro": "^0.26.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-unicorn": "^46.0.0",
"fs-extra": "^11.1.1",

View File

@ -1,14 +0,0 @@
{
"env": {
"browser": false,
"node": true
},
"parserOptions": {
"sourceType": "module"
},
"extends": "../../.eslintrc.json",
"rules": {
"no-console": "off",
"unicorn/prefer-top-level-await": "off"
}
}

View File

@ -16,8 +16,5 @@ module.exports = {
banner,
name: 'adminlte'
},
plugins: [typescript({
declaration: true,
declarationDir: 'types'
})]
plugins: [typescript()]
}

24
src/html/.eslintrc.json Normal file
View File

@ -0,0 +1,24 @@
{
"root": true,
"extends": [
"plugin:astro/recommended"
],
"overrides": [
{
// Define the configuration for `.astro` file.
"files": ["*.astro"],
// Allows Astro components to be parsed.
"parser": "astro-eslint-parser",
// Parse the script in `.astro` as TypeScript by adding the following configuration.
// It's the setting you need when using TypeScript.
"parserOptions": {
"parser": "@typescript-eslint/parser",
"extraFileExtensions": [".astro"]
},
"rules": {
// override/add rules settings here, such as:
// "astro/no-set-html-directive": "error"
}
}
]
}

View File

@ -1,3 +1,4 @@
{
"root": true,
"extends": "astro/tsconfigs/base"
}

View File

@ -1,6 +1,7 @@
---
const { path } = Astro.props
const distPath = (path != undefined) ? path : '../../../dist'
const adminlteJsUrl = distPath + '/js/adminlte.js'
---
<!-- OPTIONAL SCRIPTS -->
<!-- overlayscrollbars -->
@ -14,7 +15,7 @@ const distPath = (path != undefined) ? path : '../../../dist'
<!-- REQUIRED SCRIPTS -->
<!-- AdminLTE App -->
<script src={distPath + '/js/adminlte.js'}></script>
<script src={adminlteJsUrl} is:inline></script>
<!-- OPTIONAL SCRIPTS -->
<script is:inline>