schon/storefront/eslint.config.mjs
Alexandr SaVBaD Waltz 587c7d3428 Features: 1) Add ESLint dependencies for Vue and Astro projects, including eslint-plugin-astro and eslint-plugin-vue;
Fixes: None;

Extra: 1) Update `package-lock.json` with multiple development-related dependencies, including `vue-eslint-parser` and packages for TypeScript compatibility;
2025-06-01 18:10:45 +03:00

96 lines
No EOL
2.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 youre using TS in .js/.ts or inside .vue/.astro)
'plugin:@typescript-eslint/recommended',
// Astros 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
},
},
],
}