mirror of
https://github.com/gavvvr/obsidian-timecodes-plugin.git
synced 2026-07-22 05:38:08 +00:00
109 lines
2.9 KiB
JavaScript
109 lines
2.9 KiB
JavaScript
// @ts-check
|
|
|
|
import js from '@eslint/js'
|
|
import stylistic from '@stylistic/eslint-plugin'
|
|
import perfectionist from 'eslint-plugin-perfectionist'
|
|
import * as wdio from 'eslint-plugin-wdio'
|
|
import { defineConfig } from 'eslint/config'
|
|
import globals from 'globals'
|
|
import tseslint from 'typescript-eslint'
|
|
|
|
export default defineConfig(
|
|
{
|
|
files: ['**/*.{js,ts}'],
|
|
extends: [
|
|
js.configs.recommended,
|
|
tseslint.configs.strictTypeChecked,
|
|
tseslint.configs.stylisticTypeChecked,
|
|
],
|
|
},
|
|
stylistic.configs.customize({
|
|
jsx: false,
|
|
indent: 2,
|
|
quotes: 'single',
|
|
semi: false,
|
|
commaDangle: 'always-multiline',
|
|
braceStyle: '1tbs',
|
|
quoteProps: 'as-needed',
|
|
}),
|
|
{
|
|
// Apply `no-console` only to files inside `specific-directory/`
|
|
files: ['src/**/*'],
|
|
rules: {
|
|
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
},
|
|
},
|
|
{
|
|
rules: {
|
|
'@stylistic/curly-newline': ['error', { consistent: true }],
|
|
'@stylistic/max-len': ['error', { code: 100, ignoreUrls: true, ignoreComments: true }],
|
|
'@stylistic/array-bracket-newline': ['error', 'consistent'],
|
|
'@stylistic/array-element-newline': ['error', 'consistent'],
|
|
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
|
'@stylistic/no-confusing-arrow': 'error',
|
|
'@stylistic/nonblock-statement-body-position': 'error',
|
|
'@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
|
|
'@stylistic/padding-line-between-statements': 'error',
|
|
'@stylistic/switch-colon-spacing': 'error',
|
|
},
|
|
},
|
|
{
|
|
plugins: {
|
|
perfectionist,
|
|
},
|
|
rules: {
|
|
'perfectionist/sort-imports': ['error', {
|
|
type: 'natural',
|
|
order: 'asc',
|
|
ignoreCase: false,
|
|
newlinesBetween: 1,
|
|
environment: 'node',
|
|
groups: [
|
|
'type-import',
|
|
'value-builtin',
|
|
'value-external',
|
|
'type-internal',
|
|
'value-internal',
|
|
['type-parent', 'type-sibling', 'type-index'],
|
|
['value-parent', 'value-sibling', 'value-index'],
|
|
'ts-equals-import',
|
|
'unknown',
|
|
],
|
|
}],
|
|
'perfectionist/sort-named-imports': ['error', { order: 'asc', type: 'alphabetical' }],
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.ts'],
|
|
languageOptions: {
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.js'],
|
|
extends: [
|
|
tseslint.configs.disableTypeChecked,
|
|
],
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
globals: { ...globals.node },
|
|
sourceType: 'module',
|
|
},
|
|
},
|
|
{
|
|
files: ['e2e/**/*.ts'],
|
|
extends: [wdio.configs['flat/recommended']],
|
|
rules: {
|
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
},
|
|
},
|
|
{
|
|
ignores: [
|
|
'out/*',
|
|
'e2e/.e2e_test_vault/*',
|
|
],
|
|
},
|
|
)
|