Skip to content

Commit

Permalink
chore: migrate eslint to flat config (#1926)
Browse files Browse the repository at this point in the history
  • Loading branch information
BBboy01 authored Aug 28, 2024
1 parent db73b0c commit 35be3ad
Show file tree
Hide file tree
Showing 12 changed files with 1,281 additions and 2,682 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

68 changes: 0 additions & 68 deletions .eslintrc.json

This file was deleted.

9 changes: 0 additions & 9 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@
"styles": [],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/ngx-quill/**/*.ts",
"projects/ngx-quill/**/*.html"
]
}
}
}
}
Expand Down
94 changes: 94 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// @ts-check
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),

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

{
name: 'angular ts recommended rules',
files: ['**/*.ts'],
plugins: {
'@stylistic': stylistic,
},
extends: [
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
],
rules: {
'@angular-eslint/no-output-on-prefix': 'off',

'@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',
},
],

'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'parameter',
format: ['camelCase'],
filter: {
regex: '^Quill$',
match: false,
},
},
],
},
},

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

0 comments on commit 35be3ad

Please sign in to comment.