Skip to content

Commit 6c81d1e

Browse files
authored
chore: add editorconfig checks to eslint (#1043)
* chore: add editorconfig checks to eslint Signed-off-by: Jan Kowalleck <[email protected]> * tidy Signed-off-by: Jan Kowalleck <[email protected]> * tidy Signed-off-by: Jan Kowalleck <[email protected]> --------- Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 4cea42b commit 6c81d1e

File tree

4 files changed

+42
-26
lines changed

4 files changed

+42
-26
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/docs/.venv/**
1010
/examples/**/dist/**
1111

12+
/res/schema/
1213

1314
!/src/**
1415
!/libs/**

.eslintrc.js

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,58 +21,70 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
2121

2222
/**
2323
* @type {import('eslint').Linter.Config}
24-
* @see {@link https://eslint.org/}
24+
* @see https://eslint.org/
2525
*/
2626
module.exports = {
2727
root: true,
2828
plugins: [
2929
/* see https://github.com/lydell/eslint-plugin-simple-import-sort#readme */
3030
'simple-import-sort',
3131
/* see https://github.com/Stuk/eslint-plugin-header#readme */
32-
'header'
32+
'header',
33+
/* see https://github.com/phanect/eslint-plugin-editorconfig */
34+
'editorconfig'
3335
],
3436
env: {
3537
commonjs: true,
3638
browser: true,
3739
node: true
3840
},
41+
extends: [
42+
/* see https://github.com/phanect/eslint-plugin-editorconfig */
43+
'plugin:editorconfig/all'
44+
],
3945
rules: {
4046
// region sort imports/exports
4147
/* disable other sorters in favour of `simple-import-sort` */
42-
'import/order': 0,
43-
'sort-imports': 0,
48+
'import/order': 'off',
49+
'sort-imports': 'off',
4450
/* see https://github.com/lydell/eslint-plugin-simple-import-sort/ */
4551
'simple-import-sort/imports': 'error',
4652
'simple-import-sort/exports': 'error',
4753
// endregion sort imports/exports
4854
// region license-header
4955
/* see https://github.com/Stuk/eslint-plugin-header#readme */
50-
'header/header': ['error', './.license-header.js']
56+
'header/header': ['error', './.license-header.js'],
5157
// endregion license-header
58+
// indent is managed by plugin '*standard'
59+
'editorconfig/indent': 'off'
5260
},
5361
overrides: [
62+
{
63+
files: ['*.node.*'],
64+
env: { browser: false, node: true }
65+
},
66+
{
67+
files: ['*.web.*'],
68+
env: { browser: true, node: false }
69+
},
5470
{
5571
files: ['*.spec.*', '*.test.*'],
5672
env: {
5773
mocha: true,
58-
commonjs: true,
5974
node: true,
6075
browser: false // change, when mocha is enabled for browser
6176
}
6277
},
6378
{
6479
files: ['*.ts'],
65-
extends: [
66-
/* see https://github.com/standard/ts-standard */
67-
'standard-with-typescript'
68-
],
6980
plugins: [
7081
/* see https://github.com/microsoft/tsdoc */
7182
'eslint-plugin-tsdoc'
7283
],
73-
parserOptions: {
74-
project: './tsconfig.json'
75-
},
84+
extends: [
85+
/* see https://github.com/standard/ts-standard */
86+
'standard-with-typescript'
87+
],
7688
rules: {
7789
// region override rules from plugin 'standard-with-typescript'
7890
/* @see https://typescript-eslint.io/rules/consistent-type-imports/ */
@@ -91,20 +103,23 @@ module.exports = {
91103
/* see https://github.com/microsoft/tsdoc */
92104
'tsdoc/syntax': 'error'
93105
// endregion docs
106+
},
107+
parserOptions: {
108+
project: './tsconfig.json'
94109
}
95110
},
96111
{
97112
files: ['*.js', '*.mjs', '*.cjs'],
113+
plugins: [
114+
/* see https://github.com/gajus/eslint-plugin-jsdoc/ */
115+
'jsdoc'
116+
],
98117
extends: [
99118
/* see https://www.npmjs.com/package/eslint-config-standard */
100119
'standard',
101120
/* see https://github.com/gajus/eslint-plugin-jsdoc */
102121
'plugin:jsdoc/recommended'
103122
],
104-
plugins: [
105-
/* see https://github.com/gajus/eslint-plugin-jsdoc/ */
106-
'jsdoc'
107-
],
108123
rules: {
109124
/* see https://github.com/gajus/eslint-plugin-jsdoc */
110125
'jsdoc/no-undefined-types': 'error',

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@
7676
"@types/mocha": "^10",
7777
"@types/node": "ts5.4",
7878
"@types/spdx-expression-parse": "^3",
79+
"@typescript-eslint/eslint-plugin": "6.21.0",
7980
"c8": "^8||^9",
8081
"deepmerge": "^4.2.2",
8182
"eslint": "8.57.0",
8283
"eslint-config-standard": "17.1.0",
8384
"eslint-config-standard-with-typescript": "43.0.1",
85+
"eslint-plugin-editorconfig": "4.0.3",
8486
"eslint-plugin-header": "3.1.1",
8587
"eslint-plugin-jsdoc": "48.2.2",
8688
"eslint-plugin-simple-import-sort": "12.0.0",

res/schema/.editorconfig

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11

22
# fix settings for files that are copied over, to keep them as is
3-
[*.SNAPSHOT.xsd]
4-
indent_size = 4
5-
indent_style = space
6-
trim_trailing_whitespace = false
7-
[*.SNAPSHOT.schema.json]
8-
indent_size = 2
9-
indent_style = space
10-
trim_trailing_whitespace = false
11-
3+
[*.SNAPSHOT.*]
4+
charset = unset
5+
end_of_line = unset
6+
insert_final_newline = unset
7+
trim_trailing_whitespace = unset
8+
indent_style = unset
9+
indent_size = unset

0 commit comments

Comments
 (0)