@fookiejs/eslint-plugin 0.1.3 → 0.1.4

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.d.ts CHANGED
@@ -28,7 +28,7 @@ declare const plugin: {
28
28
  "same-type-comparison": import("@typescript-eslint/utils/ts-eslint").RuleModule<"mismatchedTypes", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
29
29
  name: string;
30
30
  };
31
- "no-any": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noAny", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
31
+ "no-any": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noAny" | "noObject" | "noObjectConstructorType" | "noEmptyObjectType", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
32
32
  name: string;
33
33
  };
34
34
  "no-type-assertion": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noTypeAssertion", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
@@ -1,5 +1,7 @@
1
1
  import { ESLintUtils } from "@typescript-eslint/utils";
2
- export declare const noAny: ESLintUtils.RuleModule<"noAny", [], unknown, ESLintUtils.RuleListener> & {
2
+ type MessageIds = "noAny" | "noObject" | "noObjectConstructorType" | "noEmptyObjectType";
3
+ export declare const noAny: ESLintUtils.RuleModule<MessageIds, [], unknown, ESLintUtils.RuleListener> & {
3
4
  name: string;
4
5
  };
6
+ export {};
5
7
  //# sourceMappingURL=no-any.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-any.d.ts","sourceRoot":"","sources":["../../src/rules/no-any.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,0BAA0B,CAAA;AAUhE,eAAO,MAAM,KAAK;;CAgBhB,CAAA"}
1
+ {"version":3,"file":"no-any.d.ts","sourceRoot":"","sources":["../../src/rules/no-any.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,0BAA0B,CAAA;AAQhE,KAAK,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,yBAAyB,GAAG,mBAAmB,CAAA;AAExF,eAAO,MAAM,KAAK;;CAkChB,CAAA"}
@@ -4,9 +4,14 @@ export const noAny = createRule({
4
4
  name: "no-any",
5
5
  meta: {
6
6
  type: "problem",
7
- docs: { description: "Disallow the any type" },
7
+ docs: { description: "Disallow the any and object types" },
8
8
  schema: [],
9
- messages: { noAny: "Do not use 'any'. Use a specific type instead." },
9
+ messages: {
10
+ noAny: "Do not use 'any'. Use a specific type instead.",
11
+ noObject: "Do not use 'object'. It is nearly as broad as 'any' — use a specific interface or Record<K, V> instead.",
12
+ noObjectConstructorType: "Do not use 'Object' as a type. Use a specific interface or Record<K, V> instead. (Object.keys() etc. are fine.)",
13
+ noEmptyObjectType: "Do not use '{}' as a type. Use a specific interface or unknown instead.",
14
+ },
10
15
  },
11
16
  defaultOptions: [],
12
17
  create(context) {
@@ -14,6 +19,19 @@ export const noAny = createRule({
14
19
  TSAnyKeyword(node) {
15
20
  context.report({ node, messageId: "noAny" });
16
21
  },
22
+ TSObjectKeyword(node) {
23
+ context.report({ node, messageId: "noObject" });
24
+ },
25
+ TSTypeReference(node) {
26
+ if (node.typeName.type === "Identifier" && node.typeName.name === "Object") {
27
+ context.report({ node, messageId: "noObjectConstructorType" });
28
+ }
29
+ },
30
+ TSTypeLiteral(node) {
31
+ if (node.members.length === 0) {
32
+ context.report({ node, messageId: "noEmptyObjectType" });
33
+ }
34
+ },
17
35
  };
18
36
  },
19
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"no-any.js","sourceRoot":"","sources":["../../src/rules/no-any.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEhE,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CACxC,CAAC,IAAI,EAAE,EAAE,CACP,yEAAyE,IAAI,KAAK,CACrF,CAAA;AAKD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e,CAAC,IAA8B;gBAC5C,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAA;YACjD,CAAC;YACD,eAAe,CAAC,IAA8B;gBAC5C,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC3E,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,yBAAyB,EAAE,CAAC,CAAA;gBAChE,CAAC;YACH,CAAC;YACD,aAAa,CAAC,IAA4B;gBACxC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBAC9B,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAA;gBAC1D,CAAC;YACH,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fookiejs/eslint-plugin",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "ESLint plugin for TypeScript code quality — naming, structure, type safety.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",