@w5s/eslint-config 3.1.0 → 3.2.1

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.js CHANGED
@@ -36,10 +36,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
 
37
37
  // ../../node_modules/@eslint/js/package.json
38
38
  var require_package = __commonJS({
39
- "../../node_modules/@eslint/js/package.json"(exports, module) {
39
+ "../../node_modules/@eslint/js/package.json"(exports$1, module) {
40
40
  module.exports = {
41
41
  name: "@eslint/js",
42
- version: "9.38.0",
42
+ version: "9.39.2",
43
43
  description: "ESLint JavaScript language implementation",
44
44
  funding: "https://eslint.org/donate",
45
45
  main: "./src/index.js",
@@ -78,7 +78,7 @@ var require_package = __commonJS({
78
78
 
79
79
  // ../../node_modules/@eslint/js/src/configs/eslint-all.js
80
80
  var require_eslint_all = __commonJS({
81
- "../../node_modules/@eslint/js/src/configs/eslint-all.js"(exports, module) {
81
+ "../../node_modules/@eslint/js/src/configs/eslint-all.js"(exports$1, module) {
82
82
  module.exports = Object.freeze({
83
83
  rules: Object.freeze({
84
84
  "accessor-pairs": "error",
@@ -287,7 +287,7 @@ var require_eslint_all = __commonJS({
287
287
 
288
288
  // ../../node_modules/@eslint/js/src/configs/eslint-recommended.js
289
289
  var require_eslint_recommended = __commonJS({
290
- "../../node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports, module) {
290
+ "../../node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports$1, module) {
291
291
  module.exports = Object.freeze({
292
292
  rules: Object.freeze({
293
293
  "constructor-super": "error",
@@ -358,7 +358,7 @@ var require_eslint_recommended = __commonJS({
358
358
 
359
359
  // ../../node_modules/@eslint/js/src/index.js
360
360
  var require_src = __commonJS({
361
- "../../node_modules/@eslint/js/src/index.js"(exports, module) {
361
+ "../../node_modules/@eslint/js/src/index.js"(exports$1, module) {
362
362
  var { name, version } = require_package();
363
363
  module.exports = {
364
364
  meta: {
@@ -879,6 +879,149 @@ var errors = () => ({
879
879
  "valid-typeof": ["error", { requireStringLiterals: true }]
880
880
  });
881
881
 
882
+ // src/rules/esRules/es6.ts
883
+ var es6 = () => ({
884
+ // enforces no braces where they can be omitted
885
+ // https://eslint.org/docs/rules/arrow-body-style
886
+ // TODO: enable requireReturnForObjectLiteral?
887
+ "arrow-body-style": ["error", "as-needed", {
888
+ requireReturnForObjectLiteral: false
889
+ }],
890
+ // require parens in arrow function arguments
891
+ // https://eslint.org/docs/rules/arrow-parens
892
+ "arrow-parens": ["error", "always"],
893
+ // require space before/after arrow function's arrow
894
+ // https://eslint.org/docs/rules/arrow-spacing
895
+ "arrow-spacing": ["error", { before: true, after: true }],
896
+ // verify super() callings in constructors
897
+ "constructor-super": "error",
898
+ // enforce the spacing around the * in generator functions
899
+ // https://eslint.org/docs/rules/generator-star-spacing
900
+ "generator-star-spacing": ["error", { before: false, after: true }],
901
+ // disallow modifying variables of class declarations
902
+ // https://eslint.org/docs/rules/no-class-assign
903
+ "no-class-assign": "error",
904
+ // disallow arrow functions where they could be confused with comparisons
905
+ // https://eslint.org/docs/rules/no-confusing-arrow
906
+ "no-confusing-arrow": ["error", {
907
+ allowParens: true
908
+ }],
909
+ // disallow modifying variables that are declared using const
910
+ "no-const-assign": "error",
911
+ // disallow duplicate class members
912
+ // https://eslint.org/docs/rules/no-dupe-class-members
913
+ "no-dupe-class-members": "error",
914
+ // disallow importing from the same path more than once
915
+ // https://eslint.org/docs/rules/no-duplicate-imports
916
+ // replaced by https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
917
+ "no-duplicate-imports": "off",
918
+ // disallow symbol constructor
919
+ // https://eslint.org/docs/rules/no-new-symbol
920
+ "no-new-symbol": "error",
921
+ // Disallow specified names in exports
922
+ // https://eslint.org/docs/rules/no-restricted-exports
923
+ "no-restricted-exports": ["error", {
924
+ restrictedNamedExports: [
925
+ "default",
926
+ // use `export default` to provide a default export
927
+ "then"
928
+ // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
929
+ ]
930
+ }],
931
+ // disallow specific imports
932
+ // https://eslint.org/docs/rules/no-restricted-imports
933
+ "no-restricted-imports": ["off", {
934
+ paths: [],
935
+ patterns: []
936
+ }],
937
+ // disallow to use this/super before super() calling in constructors.
938
+ // https://eslint.org/docs/rules/no-this-before-super
939
+ "no-this-before-super": "error",
940
+ // disallow useless computed property keys
941
+ // https://eslint.org/docs/rules/no-useless-computed-key
942
+ "no-useless-computed-key": "error",
943
+ // disallow unnecessary constructor
944
+ // https://eslint.org/docs/rules/no-useless-constructor
945
+ "no-useless-constructor": "error",
946
+ // disallow renaming import, export, and destructured assignments to the same name
947
+ // https://eslint.org/docs/rules/no-useless-rename
948
+ "no-useless-rename": ["error", {
949
+ ignoreDestructuring: false,
950
+ ignoreImport: false,
951
+ ignoreExport: false
952
+ }],
953
+ // require let or const instead of var
954
+ "no-var": "error",
955
+ // require method and property shorthand syntax for object literals
956
+ // https://eslint.org/docs/rules/object-shorthand
957
+ "object-shorthand": ["error", "always", {
958
+ ignoreConstructors: false,
959
+ avoidQuotes: true
960
+ }],
961
+ // suggest using arrow functions as callbacks
962
+ "prefer-arrow-callback": ["error", {
963
+ allowNamedFunctions: false,
964
+ allowUnboundThis: true
965
+ }],
966
+ // suggest using of const declaration for variables that are never modified after declared
967
+ "prefer-const": ["error", {
968
+ destructuring: "any",
969
+ ignoreReadBeforeAssign: true
970
+ }],
971
+ // Prefer destructuring from arrays and objects
972
+ // https://eslint.org/docs/rules/prefer-destructuring
973
+ "prefer-destructuring": ["error", {
974
+ VariableDeclarator: {
975
+ array: false,
976
+ object: true
977
+ },
978
+ AssignmentExpression: {
979
+ array: true,
980
+ object: false
981
+ }
982
+ }, {
983
+ enforceForRenamedProperties: false
984
+ }],
985
+ // disallow parseInt() in favor of binary, octal, and hexadecimal literals
986
+ // https://eslint.org/docs/rules/prefer-numeric-literals
987
+ "prefer-numeric-literals": "error",
988
+ // suggest using Reflect methods where applicable
989
+ // https://eslint.org/docs/rules/prefer-reflect
990
+ "prefer-reflect": "off",
991
+ // use rest parameters instead of arguments
992
+ // https://eslint.org/docs/rules/prefer-rest-params
993
+ "prefer-rest-params": "error",
994
+ // suggest using the spread syntax instead of .apply()
995
+ // https://eslint.org/docs/rules/prefer-spread
996
+ "prefer-spread": "error",
997
+ // suggest using template literals instead of string concatenation
998
+ // https://eslint.org/docs/rules/prefer-template
999
+ "prefer-template": "error",
1000
+ // disallow generator functions that do not have yield
1001
+ // https://eslint.org/docs/rules/require-yield
1002
+ "require-yield": "error",
1003
+ // enforce spacing between object rest-spread
1004
+ // https://eslint.org/docs/rules/rest-spread-spacing
1005
+ "rest-spread-spacing": ["error", "never"],
1006
+ // import sorting
1007
+ // https://eslint.org/docs/rules/sort-imports
1008
+ "sort-imports": ["off", {
1009
+ ignoreCase: false,
1010
+ ignoreDeclarationSort: false,
1011
+ ignoreMemberSort: false,
1012
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
1013
+ }],
1014
+ // require a Symbol description
1015
+ // https://eslint.org/docs/rules/symbol-description
1016
+ "symbol-description": "error",
1017
+ // enforce usage of spacing in template strings
1018
+ // https://eslint.org/docs/rules/template-curly-spacing
1019
+ "template-curly-spacing": "error",
1020
+ // enforce spacing around the * in yield* expressions
1021
+ // https://eslint.org/docs/rules/yield-star-spacing
1022
+ "yield-star-spacing": ["error", "after"]
1023
+ });
1024
+
882
1025
  // src/rules/esRules/overrides.ts
883
1026
  var overrides = () => ({
884
1027
  // Too many errors in components
@@ -907,10 +1050,65 @@ var overrides = () => ({
907
1050
  "unicode-bom": ["error", "never"]
908
1051
  });
909
1052
 
1053
+ // src/rules/esRules/strict.ts
1054
+ var strict = () => ({
1055
+ // babel inserts `'use strict';` for us
1056
+ strict: ["error", "never"]
1057
+ });
1058
+
1059
+ // src/rules/esRules/variables.ts
1060
+ var variables = () => ({
1061
+ // enforce or disallow variable initializations at definition
1062
+ "init-declarations": "off",
1063
+ // disallow the catch clause parameter name being the same as a variable in the outer scope
1064
+ "no-catch-shadow": "off",
1065
+ // disallow deletion of variables
1066
+ "no-delete-var": "error",
1067
+ // disallow labels that share a name with a variable
1068
+ // https://eslint.org/docs/rules/no-label-var
1069
+ "no-label-var": "error",
1070
+ // disallow specific globals
1071
+ "no-restricted-globals": [
1072
+ "error",
1073
+ {
1074
+ name: "isFinite",
1075
+ message: "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite"
1076
+ },
1077
+ {
1078
+ name: "isNaN",
1079
+ message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan"
1080
+ }
1081
+ // ...confusingBrowserGlobals.map((g) => ({
1082
+ // name: g,
1083
+ // message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
1084
+ // })),
1085
+ ],
1086
+ // disallow declaration of variables already declared in the outer scope
1087
+ "no-shadow": "error",
1088
+ // disallow shadowing of names such as arguments
1089
+ "no-shadow-restricted-names": "error",
1090
+ // disallow use of undeclared variables unless mentioned in a /*global */ block
1091
+ "no-undef": "error",
1092
+ // disallow use of undefined when initializing variables
1093
+ "no-undef-init": "error",
1094
+ // disallow use of undefined variable
1095
+ // https://eslint.org/docs/rules/no-undefined
1096
+ // TODO: enable?
1097
+ "no-undefined": "off",
1098
+ // disallow declaration of variables that are not used in the code
1099
+ "no-unused-vars": ["error", { vars: "all", args: "after-used", ignoreRestSiblings: true }],
1100
+ // disallow use of variables before they are defined
1101
+ "no-use-before-define": ["error", { functions: true, classes: true, variables: true }]
1102
+ });
1103
+
910
1104
  // src/rules/esRules.ts
911
1105
  var esRules = () => ({
912
1106
  ...bestPractices(),
913
1107
  ...errors(),
1108
+ ...es6(),
1109
+ ...strict(),
1110
+ ...variables(),
1111
+ // Must be last
914
1112
  ...overrides()
915
1113
  });
916
1114