| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| |
| import prettier from 'eslint-config-prettier'; |
| import { fileURLToPath } from 'node:url'; |
| import { includeIgnoreFile } from '@eslint/compat'; |
| import js from '@eslint/js'; |
| import svelte from 'eslint-plugin-svelte'; |
| import { defineConfig } from 'eslint/config'; |
| import globals from 'globals'; |
| import ts from 'typescript-eslint'; |
| import svelteConfig from './svelte.config.js'; |
| |
| const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url)); |
| |
| export default defineConfig( |
| includeIgnoreFile(gitignorePath), |
| { |
| ignores: [ |
| '.DS_Store', |
| 'node_modules', |
| '/build', |
| '/.svelte-kit', |
| '/package', |
| '.env', |
| '.env.*', |
| 'pnpm-lock.yaml', |
| 'package-lock.json', |
| 'yarn.lock' |
| ] |
| }, |
| js.configs.recommended, |
| // ...ts.configs.recommended, |
| ...svelte.configs.recommended, |
| prettier, |
| ...svelte.configs.prettier, |
| { |
| languageOptions: { |
| globals: { ...globals.browser, ...globals.node } |
| }, |
| rules: { |
| // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects. |
| // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors |
| 'no-undef': 'off', |
| 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }] |
| } |
| }, |
| { |
| files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'], |
| languageOptions: { |
| parserOptions: { |
| projectService: true, |
| extraFileExtensions: ['.svelte'], |
| parser: ts.parser, |
| svelteConfig |
| } |
| }, |
| rules: { |
| 'no-useless-assignment': 'off' |
| } |
| } |
| ); |