Skip to content

Commit b2969cd

Browse files
style: stylistic
1 parent a27072d commit b2969cd

20 files changed

+3471
-5170
lines changed

.eslintrc.json

Lines changed: 0 additions & 47 deletions
This file was deleted.

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"angular.ng-template",
5+
"EditorConfig.EditorConfig"
6+
]
7+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
3+
"editor.formatOnSave": true,
4+
"eslint.format.enable": true,
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll": "explicit",
7+
"source.organizeImports": "explicit",
8+
"source.fixAll.eslint": "explicit"
9+
},
10+
"yaml.schemas": {
11+
"https://json.schemastore.org/github-workflow.json": "**/.github/workflows/*.yml"
12+
},
13+
"angular.forceStrictTemplates": true,
14+
"prettier.enable": false
15+
}

angular.json

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@
2828
"tsConfig": "projects/angular-stl-model-viewer/tsconfig.spec.json",
2929
"karmaConfig": "projects/angular-stl-model-viewer/karma.conf.js"
3030
}
31-
},
32-
"lint": {
33-
"builder": "@angular-eslint/builder:lint",
34-
"options": {
35-
"lintFilePatterns": [
36-
"projects/angular-stl-model-viewer/**/*.ts",
37-
"projects/angular-stl-model-viewer/**/*.html"
38-
]
39-
}
4031
}
4132
}
4233
},
@@ -127,27 +118,6 @@
127118
],
128119
"scripts": []
129120
}
130-
},
131-
"lint": {
132-
"builder": "@angular-eslint/builder:lint",
133-
"options": {
134-
"lintFilePatterns": [
135-
"projects/examples/**/*.ts",
136-
"projects/examples/**/*.html"
137-
]
138-
}
139-
},
140-
"e2e": {
141-
"builder": "@angular-devkit/build-angular:protractor",
142-
"options": {
143-
"protractorConfig": "projects/examples/e2e/protractor.conf.js",
144-
"devServerTarget": "examples:serve"
145-
},
146-
"configurations": {
147-
"production": {
148-
"devServerTarget": "examples:serve:production"
149-
}
150-
}
151121
}
152122
}
153123
}

eslint.config.mjs

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
// @ts-check
2+
import { dirname } from 'node:path'
3+
import { fileURLToPath } from 'node:url'
4+
5+
import js from '@eslint/js'
6+
import json from '@eslint/json'
7+
import stylistic from '@stylistic/eslint-plugin'
8+
import angular from 'angular-eslint'
9+
import globals from 'globals'
10+
import tseslint from 'typescript-eslint'
11+
12+
const __filename = fileURLToPath(import.meta.url)
13+
const __dirname = dirname(__filename)
14+
15+
export default tseslint.config(
16+
{
17+
name: 'ignores',
18+
ignores: [
19+
'/**/node_modules/*',
20+
'node_modules/',
21+
'dist/',
22+
'.nx/',
23+
'.angular/',
24+
'coverage/'
25+
]
26+
},
27+
28+
{
29+
name: 'lib tsc options',
30+
files: ['projects/angular-stl-model-viewer/**/*.{ts,mts,tsx}'],
31+
languageOptions: {
32+
parser: tseslint.parser,
33+
parserOptions: {
34+
project: ['tsconfig.lib.json', 'tsconfig.spec.json'],
35+
tsconfigRootDir: 'projects/angular-stl-model-viewer'
36+
}
37+
}
38+
},
39+
{
40+
name: 'examples tsc options',
41+
files: ['projects/examples/**/*.{ts,mts,tsx}'],
42+
languageOptions: {
43+
parser: tseslint.parser,
44+
parserOptions: {
45+
project: ['tsconfig.app.json', 'tsconfig.spec.json'],
46+
tsconfigRootDir: 'projects/examples'
47+
}
48+
}
49+
},
50+
{
51+
name: 'angular ts recommended rules',
52+
files: ['projects/angular-stl-model-viewer/**/*.{ts,mts,tsx}', 'projects/examples/**/*.{ts,mts,tsx}'],
53+
plugins: {
54+
'@stylistic': stylistic
55+
},
56+
extends: [...tseslint.configs.recommended, ...tseslint.configs.stylistic, ...angular.configs.tsRecommended, stylistic.configs['recommended-flat']],
57+
rules: {
58+
'@angular-eslint/no-output-on-prefix': 'off',
59+
'@angular-eslint/component-class-suffix': [
60+
'off',
61+
{
62+
type: 'element',
63+
prefix: 'lib',
64+
style: 'kebab-case'
65+
}
66+
],
67+
'@angular-eslint/component-selector': [
68+
'off',
69+
{
70+
type: 'element',
71+
prefix: 'lib',
72+
style: 'kebab-case'
73+
}
74+
],
75+
'@angular-eslint/directive-selector': [
76+
'off',
77+
{
78+
type: 'attribute',
79+
prefix: 'lib',
80+
style: 'camelCase'
81+
}
82+
],
83+
84+
'@stylistic/no-multiple-empty-lines': [
85+
'error',
86+
{
87+
max: 1,
88+
maxBOF: 0,
89+
maxEOF: 1
90+
}
91+
],
92+
'@stylistic/semi': ['error', 'never'],
93+
'@stylistic/member-delimiter-style': [
94+
'error',
95+
{
96+
multiline: {
97+
delimiter: 'none',
98+
requireLast: true
99+
},
100+
singleline: {
101+
delimiter: 'semi',
102+
requireLast: false
103+
},
104+
multilineDetection: 'brackets'
105+
}
106+
],
107+
'@stylistic/comma-dangle': ['error', 'never'],
108+
'@stylistic/object-property-newline': ['error'],
109+
'@stylistic/object-curly-newline': ['error'],
110+
'@stylistic/object-curly-spacing': ['error', 'always'],
111+
112+
'@typescript-eslint/no-non-null-assertion': 'off',
113+
'@typescript-eslint/no-explicit-any': ['warn'],
114+
'@typescript-eslint/no-empty-function': ['warn']
115+
}
116+
},
117+
{
118+
name: 'Angular template recommended rules',
119+
files: ['projects/angular-stl-model-viewer/**/*.html', 'projects/examples/**/*.html'],
120+
extends: [...angular.configs.templateRecommended, ...angular.configs.templateAccessibility],
121+
rules: {
122+
'@angular-eslint/template/no-negated-async': 'off',
123+
'@angular-eslint/template/click-events-have-key-events': ['warn'],
124+
'@angular-eslint/template/interactive-supports-focus': ['warn']
125+
}
126+
},
127+
128+
// root files
129+
{
130+
name: 'Root files tsc options',
131+
files: ['*.{ts,tsx,mts}'],
132+
languageOptions: {
133+
parser: tseslint.parser,
134+
parserOptions: {
135+
project: ['tsconfig.json'],
136+
tsconfigRootDir: __dirname
137+
}
138+
}
139+
},
140+
{
141+
name: 'Scripts stylistic ts recommended rules',
142+
files: ['*.{ts,tsx,mts}'],
143+
plugins: {
144+
'@stylistic': stylistic
145+
},
146+
extends: [...tseslint.configs.recommended, ...tseslint.configs.stylistic, stylistic.configs['recommended-flat']],
147+
rules: {
148+
'@stylistic/no-multiple-empty-lines': [
149+
'error',
150+
{
151+
max: 1,
152+
maxBOF: 0,
153+
maxEOF: 1
154+
}
155+
],
156+
'@stylistic/semi': ['error', 'never'],
157+
'@stylistic/member-delimiter-style': [
158+
'error',
159+
{
160+
multiline: {
161+
delimiter: 'none',
162+
requireLast: true
163+
},
164+
singleline: {
165+
delimiter: 'semi',
166+
requireLast: false
167+
},
168+
multilineDetection: 'brackets'
169+
}
170+
],
171+
'@stylistic/comma-dangle': ['error', 'never'],
172+
'@stylistic/object-property-newline': ['error'],
173+
'@stylistic/object-curly-newline': ['error'],
174+
'@stylistic/object-curly-spacing': ['error', 'always'],
175+
176+
'@typescript-eslint/no-non-null-assertion': 'off',
177+
'@typescript-eslint/no-explicit-any': ['warn'],
178+
'@typescript-eslint/no-empty-function': ['warn']
179+
}
180+
},
181+
182+
{
183+
name: 'JS',
184+
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
185+
plugins: {
186+
js,
187+
'@stylistic': stylistic
188+
},
189+
extends: [js.configs.recommended, stylistic.configs['recommended-flat']],
190+
languageOptions: {
191+
globals: {
192+
...globals.node,
193+
document: false
194+
}
195+
},
196+
rules: {
197+
'@stylistic/no-multiple-empty-lines': [
198+
'error',
199+
{
200+
max: 1,
201+
maxBOF: 0,
202+
maxEOF: 1
203+
}
204+
],
205+
'@stylistic/semi': ['error', 'never'],
206+
'@stylistic/member-delimiter-style': [
207+
'error',
208+
{
209+
multiline: {
210+
delimiter: 'none',
211+
requireLast: true
212+
},
213+
singleline: {
214+
delimiter: 'semi',
215+
requireLast: false
216+
},
217+
multilineDetection: 'brackets'
218+
}
219+
],
220+
'@stylistic/comma-dangle': ['error', 'never']
221+
}
222+
},
223+
224+
// lint JSON files
225+
{
226+
files: ['**/*.json'],
227+
plugins: {
228+
json,
229+
'@stylistic': stylistic
230+
},
231+
ignores: ['package-lock.json'],
232+
language: 'json/json',
233+
extends: [json.configs.recommended]
234+
},
235+
236+
// lint JSONC files
237+
{
238+
files: ['**/*.jsonc'],
239+
plugins: {
240+
json,
241+
'@stylistic': stylistic
242+
},
243+
language: 'json/jsonc',
244+
extends: [json.configs.recommended]
245+
},
246+
247+
// lint JSON5 files
248+
{
249+
files: ['**/*.json5'],
250+
plugins: {
251+
json,
252+
'@stylistic': stylistic
253+
},
254+
language: 'json/json5',
255+
extends: [json.configs.recommended]
256+
}
257+
)

0 commit comments

Comments
 (0)