eslint-plugin-complete 1.0.0 → 1.0.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright The Complete Contributors
3
+ Copyright (c) 2024 The Complete Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # eslint-plugin-complete
1
+ # `eslint-plugin-complete`
2
2
 
3
3
  `eslint-plugin-complete` is a collection of miscellaneous [ESLint](https://eslint.org/) rules that can help make your TypeScript code more safe or more strict.
4
4
 
@@ -1,3 +1,3 @@
1
1
  import type { TSESLint } from "@typescript-eslint/utils";
2
- export declare const recommended: TSESLint.FlatConfig.ConfigArray;
2
+ export declare const recommended: TSESLint.FlatConfig.Config[];
3
3
  //# sourceMappingURL=recommended.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recommended.d.ts","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,WA2D7C,CAAC"}
1
+ {"version":3,"file":"recommended.d.ts","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM,EA2DnD,CAAC"}
package/dist/configs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const configs: {
2
- recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
2
+ recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config[];
3
3
  };
4
4
  //# sourceMappingURL=configs.d.ts.map
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ declare const plugin: {
5
5
  version: unknown;
6
6
  };
7
7
  configs: {
8
- recommended: TSESLint.FlatConfig.ConfigArray;
8
+ recommended: TSESLint.FlatConfig.Config[];
9
9
  };
10
10
  rules: {
11
11
  "complete-sentences-jsdoc": TSESLint.RuleModule<import("./completeSentence.js").CompleteSentenceMessageIds, [], import("./interfaces/MyPluginDocs.js").MyPluginDocs, TSESLint.RuleListener>;
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-readonly-parameter-types.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-readonly-parameter-types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAY1E,KAAK,OAAO,GAAG;IACb;QACE,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,wBAAwB,CAAC,EAAE,OAAO,CAAC;KACpC;CACF,CAAC;AAGF,eAAO,MAAM,4BAA4B,6MAmLvC,CAAC"}
1
+ {"version":3,"file":"prefer-readonly-parameter-types.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-readonly-parameter-types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAY1E,KAAK,OAAO,GAAG;IACb;QACE,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;QACnC,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,wBAAwB,CAAC,EAAE,OAAO,CAAC;KACpC;CACF,CAAC;AAGF,eAAO,MAAM,4BAA4B,6MA4LvC,CAAC"}
@@ -18,14 +18,22 @@ export const preferReadonlyParameterTypes = createRule({
18
18
  type: "object",
19
19
  additionalProperties: false,
20
20
  properties: {
21
- allow: readonlynessOptionsSchema.properties.allow,
21
+ allow: {
22
+ ...readonlynessOptionsSchema.properties.allow,
23
+ description: "An array of type specifiers to ignore.",
24
+ },
22
25
  checkParameterProperties: {
26
+ description: "Whether to check class parameter properties.",
23
27
  type: "boolean",
24
28
  },
25
29
  ignoreInferredTypes: {
30
+ description: "Whether to ignore parameters which don't explicitly specify a type.",
26
31
  type: "boolean",
27
32
  },
28
- treatMethodsAsReadonly: readonlynessOptionsSchema.properties.treatMethodsAsReadonly,
33
+ treatMethodsAsReadonly: {
34
+ ...readonlynessOptionsSchema.properties.treatMethodsAsReadonly,
35
+ description: "Whether to treat all mutable methods as though they are readonly.",
36
+ },
29
37
  onlyRecordsArraysMapsSet: {
30
38
  type: "boolean",
31
39
  },
@@ -77,6 +85,7 @@ export const preferReadonlyParameterTypes = createRule({
77
85
  }
78
86
  const type = services.getTypeAtLocation(actualParam);
79
87
  if (onlyRecordsArraysMapsSet === true) {
88
+ // Handle the case of only checking records, arrays, maps, and sets.
80
89
  const parts = unionTypeParts(type);
81
90
  const hasAllBasicDataStructures = parts.every((t) => {
82
91
  const typeName = getTypeName(t);
@@ -86,9 +95,8 @@ export const preferReadonlyParameterTypes = createRule({
86
95
  typeName === "Record");
87
96
  });
88
97
  if (!hasAllBasicDataStructures) {
89
- return;
98
+ continue;
90
99
  }
91
- // Handle the case of only checking records, arrays, maps, and sets.
92
100
  for (const t of parts) {
93
101
  const typeName = getTypeName(t);
94
102
  switch (typeName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-complete",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "An ESLint plugin that contains useful rules.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -44,9 +44,23 @@
44
44
  "test": "jest"
45
45
  },
46
46
  "dependencies": {
47
- "@typescript-eslint/type-utils": "^8.4.0",
48
- "@typescript-eslint/utils": "^8.4.0",
49
- "typescript-eslint": "^8.4.0"
47
+ "@typescript-eslint/type-utils": "^8.6.0",
48
+ "@typescript-eslint/utils": "^8.6.0",
49
+ "typescript-eslint": "^8.6.0"
50
+ },
51
+ "devDependencies": {
52
+ "@babel/core": "^7.25.2",
53
+ "@babel/preset-env": "^7.25.4",
54
+ "@babel/preset-typescript": "^7.24.7",
55
+ "@types/jest": "^29.5.13",
56
+ "@types/node": "^22.5.5",
57
+ "@typescript-eslint/rule-tester": "^8.6.0",
58
+ "@typescript-eslint/types": "^8.6.0",
59
+ "complete-common": "^1.0.0",
60
+ "complete-node": "^1.5.1",
61
+ "jest": "^29.7.0",
62
+ "prettier": "^3.3.3",
63
+ "typescript": "5.5.4"
50
64
  },
51
65
  "peerDependencies": {
52
66
  "eslint": ">= 9.0.0",