@odg/eslint-config 1.5.5 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -544,7 +544,17 @@ Add extends in your `.eslintrc` file
544
544
  }
545
545
  ```
546
546
 
547
- Test: `npm run eslint` or `yarn eslint`
547
+ Add script in your `package.json` file
548
+
549
+ ```json
550
+ {
551
+ "scripts": {
552
+ "lint": "eslint \"**/*.+(js|jsx|ts|tsx|json|jsonc|json5|yml|yaml|xml|txt|svg|properties|gradle|java|cpp|c|cs|html|css|groovy|gitignore|npmignore|toml|env|example|sample|ini|php|bat|powershell|ps1|sh|bash)\"",
553
+ }
554
+ }
555
+ ```
556
+
557
+ Test: `npm run lint` or `yarn lint`
548
558
 
549
559
  ## File Name Convention
550
560
 
package/index.js CHANGED
@@ -15,6 +15,7 @@ module.exports = {
15
15
  "sonar",
16
16
  "regex",
17
17
  "sonarjs",
18
+ "json-schema-validator",
18
19
  ],
19
20
  env: {
20
21
  node: true,
@@ -64,8 +65,7 @@ module.exports = {
64
65
  ".mjs",
65
66
  ".jsx",
66
67
  ],
67
- "import/core-modules": [
68
- ],
68
+ "import/core-modules": [],
69
69
  "import/ignore": [
70
70
  "node_modules",
71
71
  "\\.(coffee|scss|css|less|hbs|svg|json)$",
@@ -105,27 +105,19 @@ module.exports = {
105
105
  },
106
106
  {
107
107
  files: [ "*.json", "*.json5", "*.jsonc", ".eslintrc", "*.code-*" ],
108
- plugins: [
109
- "jsonc",
110
- ],
111
- extends: [
112
- "./rules/json/base.js",
113
- ],
108
+ plugins: [ "jsonc" ],
109
+ extends: [ "./rules/json/base.js" ],
114
110
  },
115
111
  {
116
112
  files: [ "package.json" ],
117
- extends: [
118
- "./rules/json/base.js",
119
- ],
113
+ extends: [ "./rules/json/base.js" ],
120
114
  rules: {
121
115
  "jsonc/sort-keys": [ "off" ],
122
116
  },
123
117
  },
124
118
  {
125
119
  files: [ "**.php" ],
126
- plugins: [
127
- "php-markup",
128
- ],
120
+ plugins: [ "php-markup" ],
129
121
  globals: {
130
122
  "lintPHPCode": true,
131
123
  },
@@ -138,7 +130,7 @@ module.exports = {
138
130
  "php/keep-eol": true,
139
131
  "php/remove-whitespace": false,
140
132
  "php/remove-empty-line": false,
141
- "php/remove-php-lint": true,
133
+ "php/remove-php-lint": false,
142
134
  },
143
135
  },
144
136
  {
@@ -152,21 +144,22 @@ module.exports = {
152
144
  "*.e2e.*",
153
145
  "*.e2e-spec.*",
154
146
  ],
155
- extends: [
156
- "./rules/typescript/tests.js",
157
- ],
147
+ extends: [ "./rules/typescript/tests.js" ],
158
148
  },
159
149
  {
160
150
  files: [
151
+ ".env.example",
161
152
  ".env.*",
162
153
  "*.env",
154
+ ".env.sample",
163
155
  "*.properties",
164
156
  "*.ini",
165
157
  "*.toml",
166
158
  ],
167
- extends: [
168
- "./rules/ini/base.js",
159
+ plugins: [
160
+ "toml",
169
161
  ],
162
+ extends: [ "./rules/ini/base.js" ],
170
163
  parser: "toml-eslint-parser",
171
164
  },
172
165
  {
@@ -174,12 +167,8 @@ module.exports = {
174
167
  "*.yml",
175
168
  "*.yaml",
176
169
  ],
177
- plugins: [
178
- "yml",
179
- ],
180
- extends: [
181
- "./rules/yaml/base.js",
182
- ],
170
+ plugins: [ "yml" ],
171
+ extends: [ "./rules/yaml/base.js" ],
183
172
  parser: "yaml-eslint-parser",
184
173
  parserOptions: {
185
174
  defaultYAMLVersion: "1.2",
@@ -190,9 +179,15 @@ module.exports = {
190
179
  ".github/**/*.yml",
191
180
  ".github/**/*.yaml",
192
181
  ],
193
- extends: [
194
- "./rules/yaml/github.js",
182
+ extends: [ "./rules/yaml/github.js" ],
183
+ },
184
+ {
185
+ files: [
186
+ ".gitignore",
187
+ ".npmignore",
195
188
  ],
189
+ parser: "any-eslint-parser",
190
+ extends: [ "./rules/any/base.js" ],
196
191
  },
197
192
  ],
198
193
  rules: {},
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@odg/eslint-config",
3
- "version": "1.5.5",
3
+ "version": "1.6.0",
4
4
  "description": "Linter for JavaScript And Typescript project",
5
5
  "main": "index.js",
6
6
  "author": "Dragons Gamers <https://www.linkedin.com/in/victor-alves-odgodinho>",
7
- "scripts": {},
7
+ "scripts": {
8
+ "lint": "yarn eslint \"**/*.+(js|jsx|ts|tsx|json|jsonc|json5|yml|yaml|xml|txt|svg|properties|gradle|java|cpp|c|cs|html|css|groovy|gitignore|npmignore|toml|env|example|sample|ini|php|bat|powershell|ps1|sh|bash)\""
9
+ },
8
10
  "repository": {
9
11
  "type": "git",
10
12
  "url": "git+https://github.com/ODGodinho/ODG-Linter-Js.git"
@@ -22,26 +24,29 @@
22
24
  "@odg/tsconfig": "*",
23
25
  "@typescript-eslint/eslint-plugin": "*",
24
26
  "@typescript-eslint/parser": "*",
27
+ "any-eslint-parser": "^1.0.1",
25
28
  "eslint": "*",
26
- "eslint-plugin-anti-trojan-source": "*",
27
- "eslint-plugin-array-func": "*",
28
- "eslint-plugin-filenames": "*",
29
- "eslint-plugin-html": "*",
30
- "eslint-plugin-import": "*",
31
- "eslint-plugin-jsdoc": "*",
32
- "eslint-plugin-jsonc": "*",
33
- "eslint-plugin-n": "*",
34
- "eslint-plugin-no-constructor-bind": "*",
35
- "eslint-plugin-php-markup": "*",
36
- "eslint-plugin-promise": "*",
37
- "eslint-plugin-regex": "*",
38
- "eslint-plugin-regexp": "*",
39
- "eslint-plugin-security": "*",
40
- "eslint-plugin-sonar": "*",
41
- "eslint-plugin-sonarjs": "*",
42
- "eslint-plugin-unicorn": "*",
43
- "eslint-plugin-yml": "*",
44
- "toml-eslint-parser": "*"
29
+ "eslint-plugin-anti-trojan-source": "^1.1.0",
30
+ "eslint-plugin-array-func": "^3.1.7",
31
+ "eslint-plugin-filenames": "^1.3.2",
32
+ "eslint-plugin-html": "^7.1.0",
33
+ "eslint-plugin-import": "^2.26.0",
34
+ "eslint-plugin-jsdoc": "^39.6.4",
35
+ "eslint-plugin-json-schema-validator": "^4.0.3",
36
+ "eslint-plugin-jsonc": "^2.5.0",
37
+ "eslint-plugin-n": "^15.6.0",
38
+ "eslint-plugin-no-constructor-bind": "^2.0.4",
39
+ "eslint-plugin-php-markup": "^6.0.0",
40
+ "eslint-plugin-promise": "^6.1.1",
41
+ "eslint-plugin-regex": "^1.10.0",
42
+ "eslint-plugin-regexp": "^1.11.0",
43
+ "eslint-plugin-security": "^1.5.0",
44
+ "eslint-plugin-sonar": "^0.10.0",
45
+ "eslint-plugin-sonarjs": "^0.17.0",
46
+ "eslint-plugin-toml": "^0.3.1",
47
+ "eslint-plugin-unicorn": "^45.0.2",
48
+ "eslint-plugin-yml": "^1.3.0",
49
+ "toml-eslint-parser": "^0.4.0"
45
50
  },
46
51
  "bugs": {
47
52
  "url": "https://github.com/ODGodinho/ODG-Linter-Js/issues"
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ rules: {
3
+ "filenames/match-regex": [ "off" ],
4
+ },
5
+ };
package/rules/ini/base.js CHANGED
@@ -1,5 +1,37 @@
1
1
  module.exports = {
2
2
  rules: {
3
3
  "filenames/match-regex": [ "off" ],
4
+ "max-len": [ "warn", {
5
+ code: 120,
6
+ ignoreUrls: true,
7
+ ignoreStrings: true,
8
+ ignoreTemplateLiterals: true,
9
+ } ], // Caracteres máximo por linhas
10
+ "toml/indent": [ "error" ], // Indent
11
+ "toml/keys-order": [ "error" ], // Indent
12
+ "toml/no-non-decimal-integer": [ "error" ], // No decimal int
13
+ "toml/no-space-dots": [ "error" ], // Não espace os pontos
14
+ "toml/no-unreadable-number-separator": [ "error" ], // Não faça números ilegíveis
15
+ "toml/padding-line-between-pairs": [ "error" ], // Não coloque espaço no mesmo bloco
16
+ "toml/padding-line-between-tables": [ "error" ], // Coloque espaço em []
17
+ "toml/precision-of-fractional-seconds": [ "error" ], // Não coloque grande precisão em segundos
18
+ "toml/precision-of-integer": [ "error" ], // Evite int gigantes
19
+ "toml/quoted-keys": [ "error" ], // Não Coloque aspas em key
20
+ "toml/tables-order": [ "error" ], // Ordene dentro de uma tabela
21
+ "toml/vue-custom-block/no-parsing-error": [ "error" ], // Valide toml em vue file
22
+ "toml/array-bracket-newline": [ "error" ], // Faça array em quebra de linhas
23
+ "toml/array-bracket-spacing": [ "error" ], // Espaço declarar array
24
+ "toml/array-element-newline": [ "error", "consistent" ], // Array multipla linhas
25
+ "toml/comma-style": [ "error" ], // Virgula a direita
26
+ "capitalized-comments": [ "off" ], // Virgula a direita
27
+ "toml/spaced-comment": [ "error" ], // Espaço a esquerda comentário
28
+ "toml/inline-table-curly-spacing": [ "error", "always", {
29
+ arraysInObjects: true,
30
+ objectsInObjects: true,
31
+ } ], // Espaço em declarar {}
32
+ "toml/key-spacing": [ "error", {
33
+ beforeEqual: false,
34
+ afterEqual: false,
35
+ } ], // Sem espaço antes de depois do igual
4
36
  },
5
37
  };
@@ -69,5 +69,6 @@ module.exports = {
69
69
  "sonarjs/no-duplicated-branches": [ "error" ], // Em vez de if else igual faça um ||
70
70
  "sonarjs/no-gratuitous-expressions": [ "error" ], // Não faça a mesma condição dentro de outra
71
71
  "sonarjs/no-unused-collection": [ "error" ], // Não faça array que não é usado
72
+ "json-schema-validator/no-invalid": [ "warn" ], // Validação de schema
72
73
  },
73
74
  };
@@ -15,5 +15,11 @@ module.exports = {
15
15
  "error",
16
16
  { "consistent": true },
17
17
  ], // Força quebrar linha em todos #4 os itens objeto
18
+ "max-len": [ "warn", {
19
+ code: 120,
20
+ ignoreUrls: true,
21
+ ignoreStrings: true,
22
+ ignoreTemplateLiterals: true,
23
+ } ], // Caracteres máximo por linhas
18
24
  },
19
25
  };
@@ -6,7 +6,13 @@ module.exports = {
6
6
  rules: {
7
7
  "strict": [ "off" ], // Strict javascript disable
8
8
  "indent": [ "off" ], // 4 spaces
9
- "@typescript-eslint/indent": [ "error", indentSize ], // Força indent com 4 espaços
9
+ "@typescript-eslint/indent": [
10
+ "error",
11
+ indentSize,
12
+ {
13
+ "ignoredNodes": [ "TSTypeParameterInstantiation" ],
14
+ },
15
+ ], // Força indent com 4 espaços
10
16
  "quotes": [ "off" ], // Aspas duplas
11
17
  "@typescript-eslint/quotes": [ "error", "double" ], // Força aspas dupla
12
18
  "lines-between-class-members": [ "off" ], // Força linha em branco entre props classe e funções
@@ -98,8 +104,8 @@ module.exports = {
98
104
  fixWith: "symbol",
99
105
  },
100
106
  "{}": {
101
- // eslint-disable-next-line max-len
102
- message: "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.",
107
+ message: "The `{}` type is mostly the same as `unknown`. "
108
+ + "You probably want `Record<string, unknown>` instead.",
103
109
  fixWith: recordObject,
104
110
  },
105
111
  "object": {
@@ -397,7 +403,7 @@ module.exports = {
397
403
  {
398
404
  selector: "typeLike",
399
405
  format: [
400
- "StrictPascalCase",
406
+ "PascalCase",
401
407
  "camelCase",
402
408
  ],
403
409
  },
@@ -420,11 +426,9 @@ module.exports = {
420
426
  },
421
427
  {
422
428
 
423
- // Interface name should not be prefixed with `I`.
424
429
  selector: "interface",
425
- filter: /^(?!I)[A-Z]/.source,
426
430
  format: [
427
- "StrictPascalCase",
431
+ "PascalCase",
428
432
  ],
429
433
  },
430
434
  {
@@ -20,5 +20,11 @@ module.exports = {
20
20
  "spaced-comment": [ "off" ], // Desliga regra JS
21
21
  "yml/spaced-comment": [ "error" ], // Comentarios com espaço
22
22
  "filenames/match-regex": [ "off" ], // Desliga validação de nomes
23
+ "max-len": [ "warn", {
24
+ code: 120,
25
+ ignoreUrls: true,
26
+ ignoreStrings: true,
27
+ ignoreTemplateLiterals: true,
28
+ } ], // Caracteres máximo por linhas
23
29
  },
24
30
  };