@frabbit/eslint-config 1.2.0 → 1.4.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/dist/index.cjs CHANGED
@@ -76,6 +76,8 @@ __export(src_exports, {
76
76
  pluginJsonc: () => pluginJsonc,
77
77
  pluginMarkdown: () => pluginMarkdown,
78
78
  pluginPrettier: () => pluginPrettier,
79
+ pluginSecurity: () => pluginSecurity,
80
+ pluginSonar: () => pluginSonar,
79
81
  pluginTypeScript: () => pluginTypeScript,
80
82
  pluginUnicorn: () => pluginUnicorn,
81
83
  pluginUnocss: () => pluginUnocss,
@@ -87,6 +89,8 @@ __export(src_exports, {
87
89
  presetLangsExtensions: () => presetLangsExtensions,
88
90
  prettier: () => prettier,
89
91
  reactivityTransform: () => reactivityTransform,
92
+ security: () => security,
93
+ sonar: () => sonar,
90
94
  sortPackageJson: () => sortPackageJson,
91
95
  sortTsconfig: () => sortTsconfig,
92
96
  typescript: () => typescript,
@@ -107,6 +111,8 @@ var _pluginVue = __toESM(require("eslint-plugin-vue"), 1);
107
111
  var _pluginUnocss = __toESM(require("@unocss/eslint-plugin"), 1);
108
112
  var _pluginPrettier = __toESM(require("eslint-plugin-prettier"), 1);
109
113
  var _configPrettier = __toESM(require("eslint-config-prettier"), 1);
114
+ var pluginSonar = __toESM(require("eslint-plugin-sonarjs"), 1);
115
+ var pluginSecurity = __toESM(require("eslint-plugin-security"), 1);
110
116
  var pluginImport = __toESM(require("eslint-plugin-i"), 1);
111
117
  var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
112
118
  var pluginUnusedImports = __toESM(require("eslint-plugin-unused-imports"), 1);
@@ -525,6 +531,74 @@ var prettier = [
525
531
  }
526
532
  ];
527
533
 
534
+ // src/configs/security.ts
535
+ var security = [
536
+ {
537
+ plugins: {
538
+ unicorn: pluginSecurity
539
+ },
540
+ rules: {
541
+ "security/detect-bidi-characters": "warn",
542
+ "security/detect-buffer-noassert": "warn",
543
+ "security/detect-child-process": "warn",
544
+ "security/detect-disable-mustache-escape": "warn",
545
+ "security/detect-eval-with-expression": "warn",
546
+ "security/detect-new-buffer": "warn",
547
+ "security/detect-no-csrf-before-method-override": "warn",
548
+ "security/detect-non-literal-fs-filename": "warn",
549
+ "security/detect-non-literal-regexp": "warn",
550
+ "security/detect-non-literal-require": "warn",
551
+ "security/detect-object-injection": "warn",
552
+ "security/detect-possible-timing-attacks": "warn",
553
+ "security/detect-pseudoRandomBytes": "warn",
554
+ "security/detect-unsafe-regex": "warn"
555
+ }
556
+ }
557
+ ];
558
+
559
+ // src/configs/sonar.ts
560
+ var sonar = [
561
+ {
562
+ plugins: {
563
+ unicorn: pluginSonar
564
+ },
565
+ rules: {
566
+ "sonarjs/cognitive-complexity": "error",
567
+ "sonarjs/elseif-without-else": "off",
568
+ "sonarjs/max-switch-cases": "error",
569
+ "sonarjs/no-all-duplicated-branches": "error",
570
+ "sonarjs/no-collapsible-if": "error",
571
+ "sonarjs/no-collection-size-mischeck": "error",
572
+ "sonarjs/no-duplicate-string": "error",
573
+ "sonarjs/no-duplicated-branches": "error",
574
+ "sonarjs/no-element-overwrite": "error",
575
+ "sonarjs/no-empty-collection": "error",
576
+ "sonarjs/no-extra-arguments": "error",
577
+ "sonarjs/no-gratuitous-expressions": "error",
578
+ "sonarjs/no-identical-conditions": "error",
579
+ "sonarjs/no-identical-expressions": "error",
580
+ "sonarjs/no-identical-functions": "error",
581
+ "sonarjs/no-ignored-return": "error",
582
+ "sonarjs/no-inverted-boolean-check": "off",
583
+ "sonarjs/no-nested-switch": "error",
584
+ "sonarjs/no-nested-template-literals": "error",
585
+ "sonarjs/no-one-iteration-loop": "error",
586
+ "sonarjs/no-redundant-boolean": "error",
587
+ "sonarjs/no-redundant-jump": "error",
588
+ "sonarjs/no-same-line-conditional": "error",
589
+ "sonarjs/no-small-switch": "error",
590
+ "sonarjs/no-unused-collection": "error",
591
+ "sonarjs/no-use-of-empty-return-value": "error",
592
+ "sonarjs/no-useless-catch": "error",
593
+ "sonarjs/non-existent-operator": "error",
594
+ "sonarjs/prefer-immediate-return": "error",
595
+ "sonarjs/prefer-object-literal": "error",
596
+ "sonarjs/prefer-single-boolean-return": "error",
597
+ "sonarjs/prefer-while": "error"
598
+ }
599
+ }
600
+ ];
601
+
528
602
  // src/configs/sort.ts
529
603
  var sortPackageJson = [
530
604
  {
@@ -800,9 +874,12 @@ var unicorn = [
800
874
  rules: {
801
875
  "unicorn/better-regex": "error",
802
876
  "unicorn/catch-error-name": "error",
803
- "unicorn/custom-error-definition": "error",
877
+ "unicorn/consistent-function-scoping": "off",
878
+ "unicorn/custom-error-definition": "off",
879
+ // 'unicorn/custom-error-definition': 'error',
804
880
  "unicorn/error-message": "error",
805
881
  "unicorn/escape-case": "error",
882
+ "unicorn/expiring-todo-comments": "error",
806
883
  "unicorn/explicit-length-check": "error",
807
884
  "unicorn/filename-case": [
808
885
  "error",
@@ -811,53 +888,91 @@ var unicorn = [
811
888
  ignore: [/^[A-Z]+\..*$/]
812
889
  }
813
890
  ],
814
- "unicorn/new-for-builtins": "error",
891
+ "unicorn/import-index": "warn",
892
+ "unicorn/new-for-builtins": "off",
893
+ // 'unicorn/new-for-builtins': 'error',
894
+ "unicorn/no-abusive-eslint-disable": "error",
815
895
  "unicorn/no-array-callback-reference": "error",
816
896
  "unicorn/no-array-method-this-argument": "error",
817
897
  "unicorn/no-array-push-push": "error",
818
898
  "unicorn/no-console-spaces": "error",
819
- "unicorn/no-for-loop": "error",
820
- "unicorn/no-hex-escape": "error",
899
+ "unicorn/no-fn-reference-in-iterator": "off",
900
+ "unicorn/no-for-loop": "warn",
901
+ // 'unicorn/no-for-loop': 'error',
902
+ "unicorn/no-hex-escape": "warn",
903
+ // 'unicorn/no-hex-escape': 'error',
821
904
  "unicorn/no-instanceof-array": "error",
822
905
  "unicorn/no-invalid-remove-event-listener": "error",
906
+ "unicorn/no-keyword-prefix": "warn",
823
907
  "unicorn/no-lonely-if": "error",
908
+ "unicorn/no-nested-ternary": "warn",
824
909
  "unicorn/no-new-array": "error",
825
910
  "unicorn/no-new-buffer": "error",
911
+ "unicorn/no-null": "warn",
912
+ "unicorn/no-object-as-default-parameter": "warn",
913
+ "unicorn/no-process-exit": "error",
914
+ "unicorn/no-reduce": "off",
826
915
  "unicorn/no-static-only-class": "error",
827
916
  "unicorn/no-unnecessary-await": "error",
828
- "unicorn/no-zero-fractions": `error`,
829
- "unicorn/prefer-add-event-listener": "error",
917
+ "unicorn/no-unreadable-array-destructuring": "off",
918
+ "unicorn/no-unsafe-regex": "warn",
919
+ "unicorn/no-unused-properties": "off",
920
+ "unicorn/no-useless-undefined": "warn",
921
+ "unicorn/no-zero-fractions": "warn",
922
+ // 'unicorn/no-zero-fractions': `error`,
923
+ "unicorn/number-literal-case": "error",
924
+ "unicorn/prefer-add-event-listener": "warn",
925
+ // 'unicorn/prefer-add-event-listener': 'error',
830
926
  "unicorn/prefer-array-find": "error",
927
+ // 'unicorn/prefer-array-find': 'error',
831
928
  "unicorn/prefer-array-flat-map": "error",
832
929
  "unicorn/prefer-array-index-of": "error",
833
930
  "unicorn/prefer-array-some": "error",
834
931
  "unicorn/prefer-at": "error",
835
932
  "unicorn/prefer-blob-reading-methods": "error",
933
+ "unicorn/prefer-dataset": "warn",
836
934
  "unicorn/prefer-date-now": "error",
837
935
  "unicorn/prefer-dom-node-append": "error",
838
936
  "unicorn/prefer-dom-node-dataset": "error",
839
937
  "unicorn/prefer-dom-node-remove": "error",
840
938
  "unicorn/prefer-dom-node-text-content": "error",
939
+ "unicorn/prefer-event-key": "off",
940
+ "unicorn/prefer-flat-map": "error",
841
941
  "unicorn/prefer-includes": "error",
842
942
  "unicorn/prefer-keyboard-event-key": "error",
843
943
  "unicorn/prefer-math-trunc": "error",
844
- "unicorn/prefer-modern-dom-apis": "error",
944
+ "unicorn/prefer-modern-dom-apis": "warn",
945
+ // 'unicorn/prefer-modern-dom-apis': 'error',
845
946
  "unicorn/prefer-modern-math-apis": "error",
846
947
  "unicorn/prefer-negative-index": "error",
948
+ "unicorn/prefer-node-append": "warn",
847
949
  "unicorn/prefer-node-protocol": "error",
950
+ "unicorn/prefer-node-remove": "warn",
848
951
  "unicorn/prefer-number-properties": "error",
849
- "unicorn/prefer-optional-catch-binding": "error",
952
+ "unicorn/prefer-optional-catch-binding": "warn",
953
+ // 'unicorn/prefer-optional-catch-binding': 'error',
850
954
  "unicorn/prefer-prototype-methods": "error",
851
- "unicorn/prefer-query-selector": "error",
955
+ "unicorn/prefer-query-selector": "warn",
956
+ // 'unicorn/prefer-query-selector': 'error',
852
957
  "unicorn/prefer-reflect-apply": "error",
853
958
  "unicorn/prefer-regexp-test": "error",
959
+ "unicorn/prefer-replace-all": "warn",
960
+ "unicorn/prefer-set-has": "warn",
961
+ "unicorn/prefer-spread": "error",
962
+ "unicorn/prefer-starts-ends-with": "error",
854
963
  "unicorn/prefer-string-replace-all": "error",
855
- "unicorn/prefer-string-slice": "error",
964
+ "unicorn/prefer-string-slice": "warn",
965
+ // 'unicorn/prefer-string-slice': 'error',
856
966
  "unicorn/prefer-string-starts-ends-with": "error",
857
967
  "unicorn/prefer-string-trim-start-end": "error",
858
968
  "unicorn/prefer-top-level-await": "error",
969
+ "unicorn/prefer-trim-start-end": "error",
859
970
  "unicorn/prefer-type-error": "error",
860
- "unicorn/throw-new-error": "error"
971
+ "unicorn/prevent-abbreviations": "off",
972
+ "unicorn/string-content": "off",
973
+ "unicorn/throw-new-error": "warn"
974
+ // 'unicorn/throw-new-error': 'error',
975
+ // 'unicorn/catch-error-name': 0,
861
976
  }
862
977
  }
863
978
  ];
@@ -907,7 +1022,42 @@ var reactivityTransform = [
907
1022
  }
908
1023
  ];
909
1024
  var vueCustomRules = {
1025
+ "vue/attributes-order": [
1026
+ "warn",
1027
+ {
1028
+ alphabetical: false,
1029
+ order: [
1030
+ "DEFINITION",
1031
+ "LIST_RENDERING",
1032
+ "CONDITIONALS",
1033
+ "RENDER_MODIFIERS",
1034
+ "GLOBAL",
1035
+ "UNIQUE",
1036
+ "TWO_WAY_BINDING",
1037
+ "OTHER_DIRECTIVES",
1038
+ "OTHER_ATTR",
1039
+ "EVENTS",
1040
+ "CONTENT"
1041
+ ]
1042
+ }
1043
+ ],
910
1044
  "vue/block-order": ["error", { order: ["script", "template", "style"] }],
1045
+ "vue/component-definition-name-casing": ["error", "PascalCase"],
1046
+ "vue/component-name-in-template-casing": [
1047
+ "error",
1048
+ "kebab-case",
1049
+ {
1050
+ ignores: [],
1051
+ registeredComponentsOnly: false
1052
+ }
1053
+ ],
1054
+ "vue/component-options-name-casing": ["error", "PascalCase"],
1055
+ "vue/component-tags-order": [
1056
+ "error",
1057
+ {
1058
+ order: ["docs", "template", "script", "style"]
1059
+ }
1060
+ ],
911
1061
  "vue/custom-event-name-casing": ["error", "camelCase"],
912
1062
  "vue/eqeqeq": ["error", "smart"],
913
1063
  "vue/html-self-closing": [
@@ -922,14 +1072,83 @@ var vueCustomRules = {
922
1072
  svg: "always"
923
1073
  }
924
1074
  ],
1075
+ "vue/match-component-import-name": "warn",
925
1076
  "vue/max-attributes-per-line": "off",
926
1077
  "vue/multi-word-component-names": "off",
1078
+ "vue/no-boolean-default": ["error", "default-false"],
927
1079
  "vue/no-constant-condition": "warn",
1080
+ "vue/no-duplicate-attr-inheritance": "warn",
928
1081
  "vue/no-empty-pattern": "error",
1082
+ "vue/no-irregular-whitespace": "error",
929
1083
  "vue/no-loss-of-precision": "error",
1084
+ "vue/no-multiple-objects-in-class": "error",
1085
+ "vue/no-potential-component-option-typo": [
1086
+ "error",
1087
+ {
1088
+ presets: ["vue", "nuxt"],
1089
+ threshold: 5
1090
+ }
1091
+ ],
1092
+ "vue/no-reserved-component-names": "error",
1093
+ "vue/no-static-inline-styles": [
1094
+ "error",
1095
+ {
1096
+ allowBinding: false
1097
+ }
1098
+ ],
1099
+ "vue/no-this-in-before-route-enter": "error",
1100
+ // 'vue/no-restricted-static-attribute': [
1101
+ // 'error',
1102
+ // {
1103
+ // key: 'stlye',
1104
+ // message: 'Using "stlye" is not allowed. Use "style" instead.',
1105
+ // },
1106
+ // ],
1107
+ // 'vue/no-template-target-blank': [
1108
+ // 'error',
1109
+ // {
1110
+ // allowReferrer: true,
1111
+ // enforceDynamicLinks: 'always',
1112
+ // },
1113
+ // ],
1114
+ "vue/no-undef-components": [
1115
+ "error",
1116
+ {
1117
+ ignorePatterns: ["lazy-hydrate", "no-ssr", "client-only"]
1118
+ }
1119
+ ],
1120
+ "vue/no-unsupported-features": [
1121
+ "error",
1122
+ {
1123
+ ignores: [],
1124
+ version: "^2.7.14"
1125
+ }
1126
+ ],
1127
+ "vue/no-unused-properties": [
1128
+ "error",
1129
+ {
1130
+ groups: ["props", "data", "computed", "methods", "setup"],
1131
+ ignorePublicMembers: true
1132
+ }
1133
+ ],
930
1134
  "vue/no-unused-refs": "error",
931
- "vue/no-useless-v-bind": "error",
1135
+ "vue/no-useless-concat": "warn",
1136
+ "vue/no-useless-mustaches": [
1137
+ "warn",
1138
+ {
1139
+ ignoreIncludesComment: true,
1140
+ ignoreStringEscape: true
1141
+ }
1142
+ ],
1143
+ "vue/no-useless-v-bind": [
1144
+ "warn",
1145
+ {
1146
+ ignoreIncludesComment: true,
1147
+ ignoreStringEscape: true
1148
+ }
1149
+ ],
932
1150
  "vue/no-v-html": "off",
1151
+ "vue/object-curly-spacing": "error",
933
1152
  "vue/object-shorthand": [
934
1153
  "error",
935
1154
  "always",
@@ -939,9 +1158,35 @@ var vueCustomRules = {
939
1158
  }
940
1159
  ],
941
1160
  "vue/padding-line-between-blocks": ["error", "always"],
1161
+ "vue/prefer-prop-type-boolean-first": "error",
1162
+ "vue/prefer-separate-static-class": "error",
942
1163
  "vue/prefer-template": "error",
943
- "vue/require-default-prop": "off",
944
- "vue/require-prop-types": "off"
1164
+ "vue/prefer-true-attribute-shorthand": "warn",
1165
+ "vue/prop-name-casing": ["error", "camelCase"],
1166
+ "vue/require-default-prop": "error",
1167
+ "vue/require-prop-types": "error",
1168
+ // TODO: отступы в <script>
1169
+ "vue/script-indent": [
1170
+ "error",
1171
+ 2,
1172
+ {
1173
+ baseIndent: 1,
1174
+ ignores: [],
1175
+ switchCase: 1
1176
+ }
1177
+ ],
1178
+ "vue/space-in-parens": "error",
1179
+ "vue/static-class-names-order": "off",
1180
+ "vue/v-on-handler-style": [
1181
+ "error",
1182
+ ["method", "inline-function"],
1183
+ // ["method", "inline-function"] | ["method", "inline"] | "inline-function" | "inline"
1184
+ {
1185
+ ignoreIncludesComment: true
1186
+ }
1187
+ ],
1188
+ "vue/valid-v-bind-sync": "error",
1189
+ "vue/valid-v-slot": "error"
945
1190
  };
946
1191
  var vue3Rules = {
947
1192
  ...pluginVue.configs.base.rules,
@@ -1014,7 +1259,9 @@ var presetJavaScript = [
1014
1259
  ...javascript,
1015
1260
  ...comments,
1016
1261
  ...imports,
1017
- ...unicorn
1262
+ ...unicorn,
1263
+ ...security,
1264
+ ...sonar
1018
1265
  ];
1019
1266
  var presetLangsExtensions = [
1020
1267
  ...markdown,
@@ -1102,6 +1349,8 @@ function frabbit(config = [], {
1102
1349
  pluginJsonc,
1103
1350
  pluginMarkdown,
1104
1351
  pluginPrettier,
1352
+ pluginSecurity,
1353
+ pluginSonar,
1105
1354
  pluginTypeScript,
1106
1355
  pluginUnicorn,
1107
1356
  pluginUnocss,
@@ -1113,6 +1362,8 @@ function frabbit(config = [], {
1113
1362
  presetLangsExtensions,
1114
1363
  prettier,
1115
1364
  reactivityTransform,
1365
+ security,
1366
+ sonar,
1116
1367
  sortPackageJson,
1117
1368
  sortTsconfig,
1118
1369
  typescript,
package/dist/index.d.cts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { FlatESLintConfigItem } from 'eslint-define-config';
2
+ import * as eslintPluginSonarjs from 'eslint-plugin-sonarjs';
3
+ export { eslintPluginSonarjs as pluginSonar };
4
+ import * as eslintPluginSecurity from 'eslint-plugin-security';
5
+ export { eslintPluginSecurity as pluginSecurity };
2
6
  import * as eslintPluginI from 'eslint-plugin-i';
3
7
  export { eslintPluginI as pluginImport };
4
8
  import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
@@ -30,6 +34,10 @@ declare const markdown: FlatESLintConfigItem[];
30
34
 
31
35
  declare const prettier: FlatESLintConfigItem[];
32
36
 
37
+ declare const security: FlatESLintConfigItem[];
38
+
39
+ declare const sonar: FlatESLintConfigItem[];
40
+
33
41
  declare const sortPackageJson: FlatESLintConfigItem[];
34
42
  declare const sortTsconfig: FlatESLintConfigItem[];
35
43
 
@@ -94,4 +102,4 @@ declare function frabbit(config?: FlatESLintConfigItem | FlatESLintConfigItem[],
94
102
  unocss: boolean;
95
103
  }>): FlatESLintConfigItem[];
96
104
 
97
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, all, basic, comments, configPrettier, frabbit, getVueVersion, hasTypeScript, hasVue, ignores, imports, isInEditor, javascript, jsonc, markdown, pluginAntfu, pluginComments, pluginMarkdown, pluginPrettier, pluginTypeScript, pluginUnicorn, pluginUnocss, pluginVue, basic as presetBasic, presetJavaScript, presetLangsExtensions, prettier, reactivityTransform, sortPackageJson, sortTsconfig, typescript, unicorn, unocss, vue, yml };
105
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, all, basic, comments, configPrettier, frabbit, getVueVersion, hasTypeScript, hasVue, ignores, imports, isInEditor, javascript, jsonc, markdown, pluginAntfu, pluginComments, pluginMarkdown, pluginPrettier, pluginTypeScript, pluginUnicorn, pluginUnocss, pluginVue, basic as presetBasic, presetJavaScript, presetLangsExtensions, prettier, reactivityTransform, security, sonar, sortPackageJson, sortTsconfig, typescript, unicorn, unocss, vue, yml };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { FlatESLintConfigItem } from 'eslint-define-config';
2
+ import * as eslintPluginSonarjs from 'eslint-plugin-sonarjs';
3
+ export { eslintPluginSonarjs as pluginSonar };
4
+ import * as eslintPluginSecurity from 'eslint-plugin-security';
5
+ export { eslintPluginSecurity as pluginSecurity };
2
6
  import * as eslintPluginI from 'eslint-plugin-i';
3
7
  export { eslintPluginI as pluginImport };
4
8
  import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
@@ -30,6 +34,10 @@ declare const markdown: FlatESLintConfigItem[];
30
34
 
31
35
  declare const prettier: FlatESLintConfigItem[];
32
36
 
37
+ declare const security: FlatESLintConfigItem[];
38
+
39
+ declare const sonar: FlatESLintConfigItem[];
40
+
33
41
  declare const sortPackageJson: FlatESLintConfigItem[];
34
42
  declare const sortTsconfig: FlatESLintConfigItem[];
35
43
 
@@ -94,4 +102,4 @@ declare function frabbit(config?: FlatESLintConfigItem | FlatESLintConfigItem[],
94
102
  unocss: boolean;
95
103
  }>): FlatESLintConfigItem[];
96
104
 
97
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, all, basic, comments, configPrettier, frabbit, getVueVersion, hasTypeScript, hasVue, ignores, imports, isInEditor, javascript, jsonc, markdown, pluginAntfu, pluginComments, pluginMarkdown, pluginPrettier, pluginTypeScript, pluginUnicorn, pluginUnocss, pluginVue, basic as presetBasic, presetJavaScript, presetLangsExtensions, prettier, reactivityTransform, sortPackageJson, sortTsconfig, typescript, unicorn, unocss, vue, yml };
105
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, all, basic, comments, configPrettier, frabbit, getVueVersion, hasTypeScript, hasVue, ignores, imports, isInEditor, javascript, jsonc, markdown, pluginAntfu, pluginComments, pluginMarkdown, pluginPrettier, pluginTypeScript, pluginUnicorn, pluginUnocss, pluginVue, basic as presetBasic, presetJavaScript, presetLangsExtensions, prettier, reactivityTransform, security, sonar, sortPackageJson, sortTsconfig, typescript, unicorn, unocss, vue, yml };
package/dist/index.js CHANGED
@@ -8,6 +8,8 @@ import * as _pluginVue from "eslint-plugin-vue";
8
8
  import * as _pluginUnocss from "@unocss/eslint-plugin";
9
9
  import * as _pluginPrettier from "eslint-plugin-prettier";
10
10
  import * as _configPrettier from "eslint-config-prettier";
11
+ import * as pluginSonar from "eslint-plugin-sonarjs";
12
+ import * as pluginSecurity from "eslint-plugin-security";
11
13
  import * as pluginImport from "eslint-plugin-i";
12
14
  import * as pluginJsonc from "eslint-plugin-jsonc";
13
15
  import * as pluginUnusedImports from "eslint-plugin-unused-imports";
@@ -426,6 +428,74 @@ var prettier = [
426
428
  }
427
429
  ];
428
430
 
431
+ // src/configs/security.ts
432
+ var security = [
433
+ {
434
+ plugins: {
435
+ unicorn: pluginSecurity
436
+ },
437
+ rules: {
438
+ "security/detect-bidi-characters": "warn",
439
+ "security/detect-buffer-noassert": "warn",
440
+ "security/detect-child-process": "warn",
441
+ "security/detect-disable-mustache-escape": "warn",
442
+ "security/detect-eval-with-expression": "warn",
443
+ "security/detect-new-buffer": "warn",
444
+ "security/detect-no-csrf-before-method-override": "warn",
445
+ "security/detect-non-literal-fs-filename": "warn",
446
+ "security/detect-non-literal-regexp": "warn",
447
+ "security/detect-non-literal-require": "warn",
448
+ "security/detect-object-injection": "warn",
449
+ "security/detect-possible-timing-attacks": "warn",
450
+ "security/detect-pseudoRandomBytes": "warn",
451
+ "security/detect-unsafe-regex": "warn"
452
+ }
453
+ }
454
+ ];
455
+
456
+ // src/configs/sonar.ts
457
+ var sonar = [
458
+ {
459
+ plugins: {
460
+ unicorn: pluginSonar
461
+ },
462
+ rules: {
463
+ "sonarjs/cognitive-complexity": "error",
464
+ "sonarjs/elseif-without-else": "off",
465
+ "sonarjs/max-switch-cases": "error",
466
+ "sonarjs/no-all-duplicated-branches": "error",
467
+ "sonarjs/no-collapsible-if": "error",
468
+ "sonarjs/no-collection-size-mischeck": "error",
469
+ "sonarjs/no-duplicate-string": "error",
470
+ "sonarjs/no-duplicated-branches": "error",
471
+ "sonarjs/no-element-overwrite": "error",
472
+ "sonarjs/no-empty-collection": "error",
473
+ "sonarjs/no-extra-arguments": "error",
474
+ "sonarjs/no-gratuitous-expressions": "error",
475
+ "sonarjs/no-identical-conditions": "error",
476
+ "sonarjs/no-identical-expressions": "error",
477
+ "sonarjs/no-identical-functions": "error",
478
+ "sonarjs/no-ignored-return": "error",
479
+ "sonarjs/no-inverted-boolean-check": "off",
480
+ "sonarjs/no-nested-switch": "error",
481
+ "sonarjs/no-nested-template-literals": "error",
482
+ "sonarjs/no-one-iteration-loop": "error",
483
+ "sonarjs/no-redundant-boolean": "error",
484
+ "sonarjs/no-redundant-jump": "error",
485
+ "sonarjs/no-same-line-conditional": "error",
486
+ "sonarjs/no-small-switch": "error",
487
+ "sonarjs/no-unused-collection": "error",
488
+ "sonarjs/no-use-of-empty-return-value": "error",
489
+ "sonarjs/no-useless-catch": "error",
490
+ "sonarjs/non-existent-operator": "error",
491
+ "sonarjs/prefer-immediate-return": "error",
492
+ "sonarjs/prefer-object-literal": "error",
493
+ "sonarjs/prefer-single-boolean-return": "error",
494
+ "sonarjs/prefer-while": "error"
495
+ }
496
+ }
497
+ ];
498
+
429
499
  // src/configs/sort.ts
430
500
  var sortPackageJson = [
431
501
  {
@@ -701,9 +771,12 @@ var unicorn = [
701
771
  rules: {
702
772
  "unicorn/better-regex": "error",
703
773
  "unicorn/catch-error-name": "error",
704
- "unicorn/custom-error-definition": "error",
774
+ "unicorn/consistent-function-scoping": "off",
775
+ "unicorn/custom-error-definition": "off",
776
+ // 'unicorn/custom-error-definition': 'error',
705
777
  "unicorn/error-message": "error",
706
778
  "unicorn/escape-case": "error",
779
+ "unicorn/expiring-todo-comments": "error",
707
780
  "unicorn/explicit-length-check": "error",
708
781
  "unicorn/filename-case": [
709
782
  "error",
@@ -712,53 +785,91 @@ var unicorn = [
712
785
  ignore: [/^[A-Z]+\..*$/]
713
786
  }
714
787
  ],
715
- "unicorn/new-for-builtins": "error",
788
+ "unicorn/import-index": "warn",
789
+ "unicorn/new-for-builtins": "off",
790
+ // 'unicorn/new-for-builtins': 'error',
791
+ "unicorn/no-abusive-eslint-disable": "error",
716
792
  "unicorn/no-array-callback-reference": "error",
717
793
  "unicorn/no-array-method-this-argument": "error",
718
794
  "unicorn/no-array-push-push": "error",
719
795
  "unicorn/no-console-spaces": "error",
720
- "unicorn/no-for-loop": "error",
721
- "unicorn/no-hex-escape": "error",
796
+ "unicorn/no-fn-reference-in-iterator": "off",
797
+ "unicorn/no-for-loop": "warn",
798
+ // 'unicorn/no-for-loop': 'error',
799
+ "unicorn/no-hex-escape": "warn",
800
+ // 'unicorn/no-hex-escape': 'error',
722
801
  "unicorn/no-instanceof-array": "error",
723
802
  "unicorn/no-invalid-remove-event-listener": "error",
803
+ "unicorn/no-keyword-prefix": "warn",
724
804
  "unicorn/no-lonely-if": "error",
805
+ "unicorn/no-nested-ternary": "warn",
725
806
  "unicorn/no-new-array": "error",
726
807
  "unicorn/no-new-buffer": "error",
808
+ "unicorn/no-null": "warn",
809
+ "unicorn/no-object-as-default-parameter": "warn",
810
+ "unicorn/no-process-exit": "error",
811
+ "unicorn/no-reduce": "off",
727
812
  "unicorn/no-static-only-class": "error",
728
813
  "unicorn/no-unnecessary-await": "error",
729
- "unicorn/no-zero-fractions": `error`,
730
- "unicorn/prefer-add-event-listener": "error",
814
+ "unicorn/no-unreadable-array-destructuring": "off",
815
+ "unicorn/no-unsafe-regex": "warn",
816
+ "unicorn/no-unused-properties": "off",
817
+ "unicorn/no-useless-undefined": "warn",
818
+ "unicorn/no-zero-fractions": "warn",
819
+ // 'unicorn/no-zero-fractions': `error`,
820
+ "unicorn/number-literal-case": "error",
821
+ "unicorn/prefer-add-event-listener": "warn",
822
+ // 'unicorn/prefer-add-event-listener': 'error',
731
823
  "unicorn/prefer-array-find": "error",
824
+ // 'unicorn/prefer-array-find': 'error',
732
825
  "unicorn/prefer-array-flat-map": "error",
733
826
  "unicorn/prefer-array-index-of": "error",
734
827
  "unicorn/prefer-array-some": "error",
735
828
  "unicorn/prefer-at": "error",
736
829
  "unicorn/prefer-blob-reading-methods": "error",
830
+ "unicorn/prefer-dataset": "warn",
737
831
  "unicorn/prefer-date-now": "error",
738
832
  "unicorn/prefer-dom-node-append": "error",
739
833
  "unicorn/prefer-dom-node-dataset": "error",
740
834
  "unicorn/prefer-dom-node-remove": "error",
741
835
  "unicorn/prefer-dom-node-text-content": "error",
836
+ "unicorn/prefer-event-key": "off",
837
+ "unicorn/prefer-flat-map": "error",
742
838
  "unicorn/prefer-includes": "error",
743
839
  "unicorn/prefer-keyboard-event-key": "error",
744
840
  "unicorn/prefer-math-trunc": "error",
745
- "unicorn/prefer-modern-dom-apis": "error",
841
+ "unicorn/prefer-modern-dom-apis": "warn",
842
+ // 'unicorn/prefer-modern-dom-apis': 'error',
746
843
  "unicorn/prefer-modern-math-apis": "error",
747
844
  "unicorn/prefer-negative-index": "error",
845
+ "unicorn/prefer-node-append": "warn",
748
846
  "unicorn/prefer-node-protocol": "error",
847
+ "unicorn/prefer-node-remove": "warn",
749
848
  "unicorn/prefer-number-properties": "error",
750
- "unicorn/prefer-optional-catch-binding": "error",
849
+ "unicorn/prefer-optional-catch-binding": "warn",
850
+ // 'unicorn/prefer-optional-catch-binding': 'error',
751
851
  "unicorn/prefer-prototype-methods": "error",
752
- "unicorn/prefer-query-selector": "error",
852
+ "unicorn/prefer-query-selector": "warn",
853
+ // 'unicorn/prefer-query-selector': 'error',
753
854
  "unicorn/prefer-reflect-apply": "error",
754
855
  "unicorn/prefer-regexp-test": "error",
856
+ "unicorn/prefer-replace-all": "warn",
857
+ "unicorn/prefer-set-has": "warn",
858
+ "unicorn/prefer-spread": "error",
859
+ "unicorn/prefer-starts-ends-with": "error",
755
860
  "unicorn/prefer-string-replace-all": "error",
756
- "unicorn/prefer-string-slice": "error",
861
+ "unicorn/prefer-string-slice": "warn",
862
+ // 'unicorn/prefer-string-slice': 'error',
757
863
  "unicorn/prefer-string-starts-ends-with": "error",
758
864
  "unicorn/prefer-string-trim-start-end": "error",
759
865
  "unicorn/prefer-top-level-await": "error",
866
+ "unicorn/prefer-trim-start-end": "error",
760
867
  "unicorn/prefer-type-error": "error",
761
- "unicorn/throw-new-error": "error"
868
+ "unicorn/prevent-abbreviations": "off",
869
+ "unicorn/string-content": "off",
870
+ "unicorn/throw-new-error": "warn"
871
+ // 'unicorn/throw-new-error': 'error',
872
+ // 'unicorn/catch-error-name': 0,
762
873
  }
763
874
  }
764
875
  ];
@@ -808,7 +919,42 @@ var reactivityTransform = [
808
919
  }
809
920
  ];
810
921
  var vueCustomRules = {
922
+ "vue/attributes-order": [
923
+ "warn",
924
+ {
925
+ alphabetical: false,
926
+ order: [
927
+ "DEFINITION",
928
+ "LIST_RENDERING",
929
+ "CONDITIONALS",
930
+ "RENDER_MODIFIERS",
931
+ "GLOBAL",
932
+ "UNIQUE",
933
+ "TWO_WAY_BINDING",
934
+ "OTHER_DIRECTIVES",
935
+ "OTHER_ATTR",
936
+ "EVENTS",
937
+ "CONTENT"
938
+ ]
939
+ }
940
+ ],
811
941
  "vue/block-order": ["error", { order: ["script", "template", "style"] }],
942
+ "vue/component-definition-name-casing": ["error", "PascalCase"],
943
+ "vue/component-name-in-template-casing": [
944
+ "error",
945
+ "kebab-case",
946
+ {
947
+ ignores: [],
948
+ registeredComponentsOnly: false
949
+ }
950
+ ],
951
+ "vue/component-options-name-casing": ["error", "PascalCase"],
952
+ "vue/component-tags-order": [
953
+ "error",
954
+ {
955
+ order: ["docs", "template", "script", "style"]
956
+ }
957
+ ],
812
958
  "vue/custom-event-name-casing": ["error", "camelCase"],
813
959
  "vue/eqeqeq": ["error", "smart"],
814
960
  "vue/html-self-closing": [
@@ -823,14 +969,83 @@ var vueCustomRules = {
823
969
  svg: "always"
824
970
  }
825
971
  ],
972
+ "vue/match-component-import-name": "warn",
826
973
  "vue/max-attributes-per-line": "off",
827
974
  "vue/multi-word-component-names": "off",
975
+ "vue/no-boolean-default": ["error", "default-false"],
828
976
  "vue/no-constant-condition": "warn",
977
+ "vue/no-duplicate-attr-inheritance": "warn",
829
978
  "vue/no-empty-pattern": "error",
979
+ "vue/no-irregular-whitespace": "error",
830
980
  "vue/no-loss-of-precision": "error",
981
+ "vue/no-multiple-objects-in-class": "error",
982
+ "vue/no-potential-component-option-typo": [
983
+ "error",
984
+ {
985
+ presets: ["vue", "nuxt"],
986
+ threshold: 5
987
+ }
988
+ ],
989
+ "vue/no-reserved-component-names": "error",
990
+ "vue/no-static-inline-styles": [
991
+ "error",
992
+ {
993
+ allowBinding: false
994
+ }
995
+ ],
996
+ "vue/no-this-in-before-route-enter": "error",
997
+ // 'vue/no-restricted-static-attribute': [
998
+ // 'error',
999
+ // {
1000
+ // key: 'stlye',
1001
+ // message: 'Using "stlye" is not allowed. Use "style" instead.',
1002
+ // },
1003
+ // ],
1004
+ // 'vue/no-template-target-blank': [
1005
+ // 'error',
1006
+ // {
1007
+ // allowReferrer: true,
1008
+ // enforceDynamicLinks: 'always',
1009
+ // },
1010
+ // ],
1011
+ "vue/no-undef-components": [
1012
+ "error",
1013
+ {
1014
+ ignorePatterns: ["lazy-hydrate", "no-ssr", "client-only"]
1015
+ }
1016
+ ],
1017
+ "vue/no-unsupported-features": [
1018
+ "error",
1019
+ {
1020
+ ignores: [],
1021
+ version: "^2.7.14"
1022
+ }
1023
+ ],
1024
+ "vue/no-unused-properties": [
1025
+ "error",
1026
+ {
1027
+ groups: ["props", "data", "computed", "methods", "setup"],
1028
+ ignorePublicMembers: true
1029
+ }
1030
+ ],
831
1031
  "vue/no-unused-refs": "error",
832
- "vue/no-useless-v-bind": "error",
1032
+ "vue/no-useless-concat": "warn",
1033
+ "vue/no-useless-mustaches": [
1034
+ "warn",
1035
+ {
1036
+ ignoreIncludesComment: true,
1037
+ ignoreStringEscape: true
1038
+ }
1039
+ ],
1040
+ "vue/no-useless-v-bind": [
1041
+ "warn",
1042
+ {
1043
+ ignoreIncludesComment: true,
1044
+ ignoreStringEscape: true
1045
+ }
1046
+ ],
833
1047
  "vue/no-v-html": "off",
1048
+ "vue/object-curly-spacing": "error",
834
1049
  "vue/object-shorthand": [
835
1050
  "error",
836
1051
  "always",
@@ -840,9 +1055,35 @@ var vueCustomRules = {
840
1055
  }
841
1056
  ],
842
1057
  "vue/padding-line-between-blocks": ["error", "always"],
1058
+ "vue/prefer-prop-type-boolean-first": "error",
1059
+ "vue/prefer-separate-static-class": "error",
843
1060
  "vue/prefer-template": "error",
844
- "vue/require-default-prop": "off",
845
- "vue/require-prop-types": "off"
1061
+ "vue/prefer-true-attribute-shorthand": "warn",
1062
+ "vue/prop-name-casing": ["error", "camelCase"],
1063
+ "vue/require-default-prop": "error",
1064
+ "vue/require-prop-types": "error",
1065
+ // TODO: отступы в <script>
1066
+ "vue/script-indent": [
1067
+ "error",
1068
+ 2,
1069
+ {
1070
+ baseIndent: 1,
1071
+ ignores: [],
1072
+ switchCase: 1
1073
+ }
1074
+ ],
1075
+ "vue/space-in-parens": "error",
1076
+ "vue/static-class-names-order": "off",
1077
+ "vue/v-on-handler-style": [
1078
+ "error",
1079
+ ["method", "inline-function"],
1080
+ // ["method", "inline-function"] | ["method", "inline"] | "inline-function" | "inline"
1081
+ {
1082
+ ignoreIncludesComment: true
1083
+ }
1084
+ ],
1085
+ "vue/valid-v-bind-sync": "error",
1086
+ "vue/valid-v-slot": "error"
846
1087
  };
847
1088
  var vue3Rules = {
848
1089
  ...pluginVue.configs.base.rules,
@@ -915,7 +1156,9 @@ var presetJavaScript = [
915
1156
  ...javascript,
916
1157
  ...comments,
917
1158
  ...imports,
918
- ...unicorn
1159
+ ...unicorn,
1160
+ ...security,
1161
+ ...sonar
919
1162
  ];
920
1163
  var presetLangsExtensions = [
921
1164
  ...markdown,
@@ -1002,6 +1245,8 @@ export {
1002
1245
  pluginJsonc,
1003
1246
  pluginMarkdown,
1004
1247
  pluginPrettier,
1248
+ pluginSecurity,
1249
+ pluginSonar,
1005
1250
  pluginTypeScript,
1006
1251
  pluginUnicorn,
1007
1252
  pluginUnocss,
@@ -1013,6 +1258,8 @@ export {
1013
1258
  presetLangsExtensions,
1014
1259
  prettier,
1015
1260
  reactivityTransform,
1261
+ security,
1262
+ sonar,
1016
1263
  sortPackageJson,
1017
1264
  sortTsconfig,
1018
1265
  typescript,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frabbit/eslint-config",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "packageManager": "pnpm@8.7.6",
5
5
  "description": "ESLint config for @frabbit.",
6
6
  "type": "module",
@@ -48,6 +48,8 @@
48
48
  "eslint-plugin-jsonc": "^2.9.0",
49
49
  "eslint-plugin-markdown": "^3.0.1",
50
50
  "eslint-plugin-prettier": "^5.0.0",
51
+ "eslint-plugin-security": "^1.7.1",
52
+ "eslint-plugin-sonarjs": "^0.21.0",
51
53
  "eslint-plugin-unicorn": "^48.0.1",
52
54
  "eslint-plugin-unused-imports": "^3.0.0",
53
55
  "eslint-plugin-vue": "^9.17.0",