mirror of
https://github.com/jcreek/OpenNetworkDiagram.git
synced 2026-07-12 18:43:44 +00:00
chore(#2): Standardize eslint, prettier, and vscode lint settings
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
|
||||
"plugins": ["prettier-plugin-tailwindcss", "prettier-plugin-svelte"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.svelte",
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "always"
|
||||
},
|
||||
"eslint.useFlatConfig": true,
|
||||
"eslint.validate": ["javascript", "typescript", "svelte"]
|
||||
}
|
||||
+63
-11
@@ -1,37 +1,89 @@
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import js from '@eslint/js';
|
||||
import { includeIgnoreFile } from '@eslint/compat';
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
import js from '@eslint/js';
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import svelte from 'eslint-plugin-svelte';
|
||||
import globals from 'globals';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import ts from 'typescript-eslint';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import svelteConfig from './svelte.config.js';
|
||||
|
||||
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
|
||||
const baseDirectory = path.dirname(fileURLToPath(import.meta.url));
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory,
|
||||
recommendedConfig: js.configs.recommended
|
||||
});
|
||||
|
||||
export default ts.config(
|
||||
const airbnbBaseConfig = compat.extends('airbnb-base').map((config) => ({
|
||||
...config,
|
||||
files: ['**/*.{js,cjs,mjs,ts,cts,mts}']
|
||||
}));
|
||||
|
||||
export default tseslint.config(
|
||||
includeIgnoreFile(gitignorePath),
|
||||
js.configs.recommended,
|
||||
...ts.configs.recommended,
|
||||
...svelte.configs.recommended,
|
||||
{
|
||||
ignores: ['eslint.config.js', 'svelte.config.js', 'vite.config.ts']
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
import: importPlugin
|
||||
}
|
||||
},
|
||||
...airbnbBaseConfig,
|
||||
...tseslint.configs.recommended,
|
||||
...svelte.configs['flat/recommended'],
|
||||
prettier,
|
||||
...svelte.configs.prettier,
|
||||
...svelte.configs['flat/prettier'],
|
||||
{
|
||||
languageOptions: {
|
||||
globals: { ...globals.browser, ...globals.node }
|
||||
},
|
||||
rules: { 'no-undef': 'off' }
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
extensions: ['.js', '.mjs', '.cjs', '.ts', '.d.ts', '.svelte', '.json']
|
||||
}
|
||||
},
|
||||
'import/extensions': ['.js', '.ts', '.mjs', '.svelte']
|
||||
},
|
||||
rules: {
|
||||
curly: ['error', 'all'],
|
||||
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
|
||||
'no-continue': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'no-inner-declarations': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'import/no-extraneous-dependencies': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||||
'import/extensions': [
|
||||
'error',
|
||||
'ignorePackages',
|
||||
{
|
||||
js: 'never',
|
||||
mjs: 'never',
|
||||
cjs: 'never',
|
||||
ts: 'never'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
||||
ignores: ['eslint.config.js', 'svelte.config.js'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
extraFileExtensions: ['.svelte'],
|
||||
parser: ts.parser,
|
||||
parser: tseslint.parser,
|
||||
svelteConfig
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
// Svelte components commonly export mutable props and top-level declarations.
|
||||
'import/prefer-default-export': 'off',
|
||||
'import/no-mutable-exports': 'off'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user