Fixes: None; Extra: 1) Update `package-lock.json` with multiple development-related dependencies, including `vue-eslint-parser` and packages for TypeScript compatibility;
96 lines
No EOL
2.8 KiB
JavaScript
96 lines
No EOL
2.8 KiB
JavaScript
module.exports = {
|
||
root: true,
|
||
env: {
|
||
browser: true,
|
||
node: true,
|
||
es2021: true,
|
||
},
|
||
parserOptions: {
|
||
ecmaVersion: 2021,
|
||
sourceType: 'module',
|
||
// Allow ESLint to recognize .vue and .astro files
|
||
extraFileExtensions: ['.vue', '.astro'],
|
||
},
|
||
extends: [
|
||
// Basic recommended rules from ESLint
|
||
'eslint:recommended',
|
||
|
||
// Vue 3 best practices (uses vue-eslint-parser under the hood)
|
||
'plugin:vue/vue3-recommended', // :contentReference[oaicite:0]{index=0}
|
||
|
||
// TypeScript support (if you’re using TS in .js/.ts or inside .vue/.astro)
|
||
'plugin:@typescript-eslint/recommended',
|
||
|
||
// Astro’s own recommended ruleset
|
||
'plugin:astro/recommended', // :contentReference[oaicite:1]{index=1}
|
||
],
|
||
plugins: [
|
||
'vue',
|
||
'@typescript-eslint',
|
||
'astro',
|
||
],
|
||
rules: {
|
||
// Customize global rules here (if needed). For example:
|
||
// '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||
},
|
||
overrides: [
|
||
// ————— Override for `.astro` files —————
|
||
{
|
||
files: ['*.astro'],
|
||
parser: 'astro-eslint-parser',
|
||
parserOptions: {
|
||
// Inside <script> blocks in .astro, treat code as TS by default
|
||
parser: '@typescript-eslint/parser',
|
||
ecmaVersion: 2021,
|
||
sourceType: 'module',
|
||
},
|
||
extends: [
|
||
// Minimal Astro linting (parses frontmatter, template, etc.)
|
||
'plugin:astro/recommended', // :contentReference[oaicite:2]{index=2}
|
||
],
|
||
rules: {
|
||
// Astro-specific rule overrides, e.g.:
|
||
// 'astro/no-set-html-directive': 'error'
|
||
},
|
||
},
|
||
|
||
// ————— Override for `.vue` files —————
|
||
{
|
||
files: ['*.vue'],
|
||
parser: 'vue-eslint-parser',
|
||
parserOptions: {
|
||
// Delegate script blocks in .vue to TypeScript or plain JS
|
||
parser: '@typescript-eslint/parser',
|
||
ecmaVersion: 2021,
|
||
sourceType: 'module',
|
||
},
|
||
extends: [
|
||
// Vue 3 recommended rules
|
||
'plugin:vue/vue3-recommended', // :contentReference[oaicite:3]{index=3}
|
||
// If using TS inside .vue, this ensures type-aware rules
|
||
'plugin:@typescript-eslint/recommended',
|
||
],
|
||
rules: {
|
||
// Vue-specific rule overrides, e.g.:
|
||
// 'vue/no-mutating-props': 'error'
|
||
},
|
||
},
|
||
|
||
// ————— Override for plain `.js` / `.ts` / `.jsx` / `.tsx` files —————
|
||
{
|
||
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
|
||
parser: '@typescript-eslint/parser',
|
||
parserOptions: {
|
||
ecmaVersion: 2021,
|
||
sourceType: 'module',
|
||
},
|
||
extends: [
|
||
'eslint:recommended',
|
||
'plugin:@typescript-eslint/recommended',
|
||
],
|
||
rules: {
|
||
// Project-wide JS/TS rule overrides, if any
|
||
},
|
||
},
|
||
],
|
||
} |