Skip to content

Commit

Permalink
chore: deps, eslint js, json, fix ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
KillerCodeMonkey committed Sep 10, 2024
1 parent 1c1728e commit 292a119
Show file tree
Hide file tree
Showing 8 changed files with 559 additions and 381 deletions.
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"angular.ng-template",
"EditorConfig.EditorConfig"
]
}
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
},
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "**/.github/workflows/*.yml"
},
"prettier.enable": false
}
127 changes: 102 additions & 25 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
// @ts-check
import js from '@eslint/js'
import json from '@eslint/json'
import stylistic from '@stylistic/eslint-plugin'
import angular from 'angular-eslint'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { includeIgnoreFile } from '@eslint/compat'

import angular from 'angular-eslint'
import tseslint from 'typescript-eslint'
import stylistic from '@stylistic/eslint-plugin'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const gitignorePath = path.resolve(__dirname, '.gitignore')

export default tseslint.config(
includeIgnoreFile(gitignorePath),
{
ignores: ['.nx', 'coverage', 'dist', '.angular', 'node_modules']
},

{
name: 'tsc options',
files: ['**/*.ts'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: ['tsconfig.json', 'e2e/tsconfig.json'],
tsconfigRootDir: __dirname,
},
},
project: ['tsconfig.json', 'e2e/tsconfig.json', 'projects/ngx-quill/tsconfig.lib.json', 'projects/ngx-quill/tsconfig.spec.json'],
tsconfigRootDir: __dirname
}
}
},

{
name: 'angular ts recommended rules',
files: ['**/*.ts'],
plugins: {
'@stylistic': stylistic,
'@stylistic': stylistic
},
extends: [
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
...angular.configs.tsRecommended
],
rules: {
'@angular-eslint/no-output-on-prefix': 'off',
Expand All @@ -45,23 +47,23 @@ export default tseslint.config(
{
max: 1,
maxBOF: 0,
maxEOF: 1,
},
maxEOF: 1
}
],
'@stylistic/semi': ['error', 'never'],
'@stylistic/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none',
requireLast: true,
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: false,
requireLast: false
},
multilineDetection: 'brackets',
},
multilineDetection: 'brackets'
}
],

'@typescript-eslint/no-explicit-any': 'off',
Expand All @@ -73,22 +75,97 @@ export default tseslint.config(
format: ['camelCase'],
filter: {
regex: '^Quill$',
match: false,
},
},
],
},
match: false
}
}
]
}
},

{
name: 'angular template recommended rules',
files: ['**/*.html'],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
...angular.configs.templateAccessibility
],
rules: {
'@angular-eslint/template/no-negated-async': 'off',
'@angular-eslint/template/no-negated-async': 'off'
}
},

{
name: 'JS',
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
plugins: {
js,
'@stylistic': stylistic
},
extends: [js.configs.recommended, stylistic.configs['recommended-flat']],
languageOptions: {
globals: {
...globals.node
}
},
rules: {
'@stylistic/no-multiple-empty-lines': [
'error',
{
max: 1,
maxBOF: 0,
maxEOF: 1
}
],
'@stylistic/semi': ['error', 'never'],
'@stylistic/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: false
},
multilineDetection: 'brackets'
}
],
'@stylistic/comma-dangle': ['error', 'never']
}
},

// lint JSON files
{
files: ['**/*.json'],
plugins: {
json,
'@stylistic': stylistic
},
ignores: ['package-lock.json'],
language: 'json/json',
extends: [json.configs.recommended]
},

// lint JSONC files
{
files: ['**/*.jsonc'],
plugins: {
json,
'@stylistic': stylistic
},
language: 'json/jsonc',
extends: [json.configs.recommended]
},

// lint JSON5 files
{
files: ['**/*.json5'],
plugins: {
json,
'@stylistic': stylistic
},
language: 'json/json5',
extends: [json.configs.recommended]
}
)
Loading

0 comments on commit 292a119

Please sign in to comment.