eslint-plugin-nextjs 0.1.2 → 1.0.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.
Files changed (158) hide show
  1. package/README.md +13 -13
  2. package/dist/index.d.ts +3 -6
  3. package/dist/index.js +399 -264
  4. package/dist/index.js.map +1 -1
  5. package/package.json +18 -12
  6. package/dist/index.cjs +0 -1485
  7. package/dist/index.cjs.map +0 -1
  8. package/dist/index.d.cts +0 -11
  9. package/dist/rules/google-font-display.cjs +0 -119
  10. package/dist/rules/google-font-display.cjs.map +0 -1
  11. package/dist/rules/google-font-display.d.cts +0 -8
  12. package/dist/rules/google-font-display.d.ts +0 -8
  13. package/dist/rules/google-font-display.js +0 -92
  14. package/dist/rules/google-font-display.js.map +0 -1
  15. package/dist/rules/google-font-preconnect.cjs +0 -109
  16. package/dist/rules/google-font-preconnect.cjs.map +0 -1
  17. package/dist/rules/google-font-preconnect.d.cts +0 -5
  18. package/dist/rules/google-font-preconnect.d.ts +0 -5
  19. package/dist/rules/google-font-preconnect.js +0 -82
  20. package/dist/rules/google-font-preconnect.js.map +0 -1
  21. package/dist/rules/inline-script-id.cjs +0 -94
  22. package/dist/rules/inline-script-id.cjs.map +0 -1
  23. package/dist/rules/inline-script-id.d.cts +0 -5
  24. package/dist/rules/inline-script-id.d.ts +0 -5
  25. package/dist/rules/inline-script-id.js +0 -67
  26. package/dist/rules/inline-script-id.js.map +0 -1
  27. package/dist/rules/next-script-for-ga.cjs +0 -129
  28. package/dist/rules/next-script-for-ga.cjs.map +0 -1
  29. package/dist/rules/next-script-for-ga.d.cts +0 -5
  30. package/dist/rules/next-script-for-ga.d.ts +0 -5
  31. package/dist/rules/next-script-for-ga.js +0 -102
  32. package/dist/rules/next-script-for-ga.js.map +0 -1
  33. package/dist/rules/no-assign-module-variable.cjs +0 -64
  34. package/dist/rules/no-assign-module-variable.cjs.map +0 -1
  35. package/dist/rules/no-assign-module-variable.d.cts +0 -5
  36. package/dist/rules/no-assign-module-variable.d.ts +0 -5
  37. package/dist/rules/no-assign-module-variable.js +0 -37
  38. package/dist/rules/no-assign-module-variable.js.map +0 -1
  39. package/dist/rules/no-async-client-component.cjs +0 -99
  40. package/dist/rules/no-async-client-component.cjs.map +0 -1
  41. package/dist/rules/no-async-client-component.d.cts +0 -5
  42. package/dist/rules/no-async-client-component.d.ts +0 -5
  43. package/dist/rules/no-async-client-component.js +0 -72
  44. package/dist/rules/no-async-client-component.js.map +0 -1
  45. package/dist/rules/no-before-interactive-script-outside-document.cjs +0 -94
  46. package/dist/rules/no-before-interactive-script-outside-document.cjs.map +0 -1
  47. package/dist/rules/no-before-interactive-script-outside-document.d.cts +0 -5
  48. package/dist/rules/no-before-interactive-script-outside-document.d.ts +0 -5
  49. package/dist/rules/no-before-interactive-script-outside-document.js +0 -59
  50. package/dist/rules/no-before-interactive-script-outside-document.js.map +0 -1
  51. package/dist/rules/no-css-tags.cjs +0 -70
  52. package/dist/rules/no-css-tags.cjs.map +0 -1
  53. package/dist/rules/no-css-tags.d.cts +0 -5
  54. package/dist/rules/no-css-tags.d.ts +0 -5
  55. package/dist/rules/no-css-tags.js +0 -43
  56. package/dist/rules/no-css-tags.js.map +0 -1
  57. package/dist/rules/no-document-import-in-page.cjs +0 -74
  58. package/dist/rules/no-document-import-in-page.cjs.map +0 -1
  59. package/dist/rules/no-document-import-in-page.d.cts +0 -5
  60. package/dist/rules/no-document-import-in-page.d.ts +0 -5
  61. package/dist/rules/no-document-import-in-page.js +0 -39
  62. package/dist/rules/no-document-import-in-page.js.map +0 -1
  63. package/dist/rules/no-duplicate-head.cjs +0 -87
  64. package/dist/rules/no-duplicate-head.cjs.map +0 -1
  65. package/dist/rules/no-duplicate-head.d.cts +0 -5
  66. package/dist/rules/no-duplicate-head.d.ts +0 -5
  67. package/dist/rules/no-duplicate-head.js +0 -60
  68. package/dist/rules/no-duplicate-head.js.map +0 -1
  69. package/dist/rules/no-head-element.cjs +0 -76
  70. package/dist/rules/no-head-element.cjs.map +0 -1
  71. package/dist/rules/no-head-element.d.cts +0 -5
  72. package/dist/rules/no-head-element.d.ts +0 -5
  73. package/dist/rules/no-head-element.js +0 -41
  74. package/dist/rules/no-head-element.js.map +0 -1
  75. package/dist/rules/no-head-import-in-document.cjs +0 -76
  76. package/dist/rules/no-head-import-in-document.cjs.map +0 -1
  77. package/dist/rules/no-head-import-in-document.d.cts +0 -5
  78. package/dist/rules/no-head-import-in-document.d.ts +0 -5
  79. package/dist/rules/no-head-import-in-document.js +0 -41
  80. package/dist/rules/no-head-import-in-document.js.map +0 -1
  81. package/dist/rules/no-html-link-for-pages.cjs +0 -302
  82. package/dist/rules/no-html-link-for-pages.cjs.map +0 -1
  83. package/dist/rules/no-html-link-for-pages.d.cts +0 -5
  84. package/dist/rules/no-html-link-for-pages.d.ts +0 -5
  85. package/dist/rules/no-html-link-for-pages.js +0 -267
  86. package/dist/rules/no-html-link-for-pages.js.map +0 -1
  87. package/dist/rules/no-img-element.cjs +0 -83
  88. package/dist/rules/no-img-element.cjs.map +0 -1
  89. package/dist/rules/no-img-element.d.cts +0 -5
  90. package/dist/rules/no-img-element.d.ts +0 -5
  91. package/dist/rules/no-img-element.js +0 -48
  92. package/dist/rules/no-img-element.js.map +0 -1
  93. package/dist/rules/no-page-custom-font.cjs +0 -184
  94. package/dist/rules/no-page-custom-font.cjs.map +0 -1
  95. package/dist/rules/no-page-custom-font.d.cts +0 -5
  96. package/dist/rules/no-page-custom-font.d.ts +0 -5
  97. package/dist/rules/no-page-custom-font.js +0 -159
  98. package/dist/rules/no-page-custom-font.js.map +0 -1
  99. package/dist/rules/no-script-component-in-head.cjs +0 -74
  100. package/dist/rules/no-script-component-in-head.cjs.map +0 -1
  101. package/dist/rules/no-script-component-in-head.d.cts +0 -5
  102. package/dist/rules/no-script-component-in-head.d.ts +0 -5
  103. package/dist/rules/no-script-component-in-head.js +0 -47
  104. package/dist/rules/no-script-component-in-head.js.map +0 -1
  105. package/dist/rules/no-styled-jsx-in-document.cjs +0 -78
  106. package/dist/rules/no-styled-jsx-in-document.cjs.map +0 -1
  107. package/dist/rules/no-styled-jsx-in-document.d.cts +0 -5
  108. package/dist/rules/no-styled-jsx-in-document.d.ts +0 -5
  109. package/dist/rules/no-styled-jsx-in-document.js +0 -43
  110. package/dist/rules/no-styled-jsx-in-document.js.map +0 -1
  111. package/dist/rules/no-sync-scripts.cjs +0 -64
  112. package/dist/rules/no-sync-scripts.cjs.map +0 -1
  113. package/dist/rules/no-sync-scripts.d.cts +0 -5
  114. package/dist/rules/no-sync-scripts.d.ts +0 -5
  115. package/dist/rules/no-sync-scripts.js +0 -37
  116. package/dist/rules/no-sync-scripts.js.map +0 -1
  117. package/dist/rules/no-title-in-document-head.cjs +0 -78
  118. package/dist/rules/no-title-in-document-head.cjs.map +0 -1
  119. package/dist/rules/no-title-in-document-head.d.cts +0 -5
  120. package/dist/rules/no-title-in-document-head.d.ts +0 -5
  121. package/dist/rules/no-title-in-document-head.js +0 -51
  122. package/dist/rules/no-title-in-document-head.js.map +0 -1
  123. package/dist/rules/no-typos.cjs +0 -133
  124. package/dist/rules/no-typos.cjs.map +0 -1
  125. package/dist/rules/no-typos.d.cts +0 -5
  126. package/dist/rules/no-typos.d.ts +0 -5
  127. package/dist/rules/no-typos.js +0 -98
  128. package/dist/rules/no-typos.js.map +0 -1
  129. package/dist/rules/no-unwanted-polyfillio.cjs +0 -164
  130. package/dist/rules/no-unwanted-polyfillio.cjs.map +0 -1
  131. package/dist/rules/no-unwanted-polyfillio.d.cts +0 -5
  132. package/dist/rules/no-unwanted-polyfillio.d.ts +0 -5
  133. package/dist/rules/no-unwanted-polyfillio.js +0 -137
  134. package/dist/rules/no-unwanted-polyfillio.js.map +0 -1
  135. package/dist/utils/define-rule.cjs +0 -31
  136. package/dist/utils/define-rule.cjs.map +0 -1
  137. package/dist/utils/define-rule.d.cts +0 -5
  138. package/dist/utils/define-rule.d.ts +0 -5
  139. package/dist/utils/define-rule.js +0 -6
  140. package/dist/utils/define-rule.js.map +0 -1
  141. package/dist/utils/get-root-dirs.cjs +0 -60
  142. package/dist/utils/get-root-dirs.cjs.map +0 -1
  143. package/dist/utils/get-root-dirs.d.cts +0 -8
  144. package/dist/utils/get-root-dirs.d.ts +0 -8
  145. package/dist/utils/get-root-dirs.js +0 -25
  146. package/dist/utils/get-root-dirs.js.map +0 -1
  147. package/dist/utils/node-attributes.cjs +0 -67
  148. package/dist/utils/node-attributes.cjs.map +0 -1
  149. package/dist/utils/node-attributes.d.cts +0 -15
  150. package/dist/utils/node-attributes.d.ts +0 -15
  151. package/dist/utils/node-attributes.js +0 -46
  152. package/dist/utils/node-attributes.js.map +0 -1
  153. package/dist/utils/url.cjs +0 -167
  154. package/dist/utils/url.cjs.map +0 -1
  155. package/dist/utils/url.d.cts +0 -35
  156. package/dist/utils/url.d.ts +0 -35
  157. package/dist/utils/url.js +0 -128
  158. package/dist/utils/url.js.map +0 -1
@@ -1,37 +0,0 @@
1
- // src/utils/define-rule.ts
2
- var defineRule = (rule) => rule;
3
-
4
- // src/rules/no-assign-module-variable.ts
5
- var url = "https://nextjs.org/docs/messages/no-assign-module-variable";
6
- var noAssignModuleVariable = defineRule({
7
- create: (context) => ({
8
- VariableDeclaration: (node) => {
9
- const moduleVariableFound = node.declarations.some((declaration) => {
10
- if ("name" in declaration.id) {
11
- return declaration.id.name === "module";
12
- }
13
- return false;
14
- });
15
- if (!moduleVariableFound) {
16
- return;
17
- }
18
- context.report({
19
- message: `Do not assign to the variable \`module\`. See: ${url}`,
20
- node
21
- });
22
- }
23
- }),
24
- meta: {
25
- docs: {
26
- description: "Prevent assignment to the `module` variable.",
27
- recommended: true,
28
- url
29
- },
30
- schema: [],
31
- type: "problem"
32
- }
33
- });
34
- export {
35
- noAssignModuleVariable
36
- };
37
- //# sourceMappingURL=no-assign-module-variable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/define-rule.ts","../../src/rules/no-assign-module-variable.ts"],"sourcesContent":["import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n","import { defineRule } from \"../utils/define-rule.js\";\nconst url = \"https://nextjs.org/docs/messages/no-assign-module-variable\";\n\nexport const noAssignModuleVariable = defineRule({\n create: (context: any) => ({\n VariableDeclaration: (node: any) => {\n // Checks node.declarations array for variable with id.name of `module`\n const moduleVariableFound = node.declarations.some((declaration: any) => {\n if (\"name\" in declaration.id) {\n return declaration.id.name === \"module\";\n }\n return false;\n });\n\n // Return early if no `module` variable is found\n if (!moduleVariableFound) {\n return;\n }\n\n context.report({\n message: `Do not assign to the variable \\`module\\`. See: ${url}`,\n node,\n });\n },\n }),\n\n meta: {\n docs: {\n description: \"Prevent assignment to the `module` variable.\",\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n"],"mappings":";AAEO,IAAM,aAAa,CAAC,SAA2C;;;ACDtE,IAAM,MAAM;AAEL,IAAM,yBAAyB,WAAW;AAAA,EAC/C,QAAQ,CAAC,aAAkB;AAAA,IACzB,qBAAqB,CAAC,SAAc;AAElC,YAAM,sBAAsB,KAAK,aAAa,KAAK,CAAC,gBAAqB;AACvE,YAAI,UAAU,YAAY,IAAI;AAC5B,iBAAO,YAAY,GAAG,SAAS;AAAA,QACjC;AACA,eAAO;AAAA,MACT,CAAC;AAGD,UAAI,CAAC,qBAAqB;AACxB;AAAA,MACF;AAEA,cAAQ,OAAO;AAAA,QACb,SAAS,kDAAkD,GAAG;AAAA,QAC9D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":[]}
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/rules/no-async-client-component.ts
21
- var no_async_client_component_exports = {};
22
- __export(no_async_client_component_exports, {
23
- noAsyncClientComponent: () => noAsyncClientComponent
24
- });
25
- module.exports = __toCommonJS(no_async_client_component_exports);
26
-
27
- // src/utils/define-rule.ts
28
- var defineRule = (rule) => rule;
29
-
30
- // src/rules/no-async-client-component.ts
31
- var url = "https://nextjs.org/docs/messages/no-async-client-component";
32
- var description = "Prevent client components from being async functions.";
33
- var message = `${description} See: ${url}`;
34
- var isCapitalized = (str) => /[A-Z]/.test(str[0] ?? "");
35
- var noAsyncClientComponent = defineRule({
36
- create: (context) => ({
37
- Program: (node) => {
38
- let isClientComponent = false;
39
- for (const block of node.body) {
40
- if (block.type === "ExpressionStatement" && block.expression.type === "Literal" && block.expression.value === "use client") {
41
- isClientComponent = true;
42
- }
43
- if (block.type === "ExportDefaultDeclaration" && isClientComponent) {
44
- if (block.declaration?.type === "FunctionDeclaration" && block.declaration.async && isCapitalized(block.declaration.id.name)) {
45
- context.report({
46
- message,
47
- node: block
48
- });
49
- }
50
- if (block.declaration.type === "Identifier" && isCapitalized(block.declaration.name)) {
51
- const targetName = block.declaration.name;
52
- const functionDeclaration = node.body.find((localBlock) => {
53
- if (localBlock.type === "FunctionDeclaration" && localBlock.id.name === targetName) {
54
- return true;
55
- }
56
- if (localBlock.type === "VariableDeclaration" && localBlock.declarations.find(
57
- (declaration) => declaration.id?.type === "Identifier" && declaration.id.name === targetName
58
- )) {
59
- return true;
60
- }
61
- return false;
62
- });
63
- if (functionDeclaration?.type === "FunctionDeclaration" && functionDeclaration.async) {
64
- context.report({
65
- message,
66
- node: functionDeclaration
67
- });
68
- }
69
- if (functionDeclaration?.type === "VariableDeclaration") {
70
- const varDeclarator = functionDeclaration.declarations.find(
71
- (declaration) => declaration.id?.type === "Identifier" && declaration.id.name === targetName
72
- );
73
- if (varDeclarator?.init?.type === "ArrowFunctionExpression" && varDeclarator.init.async) {
74
- context.report({
75
- message,
76
- node: functionDeclaration
77
- });
78
- }
79
- }
80
- }
81
- }
82
- }
83
- }
84
- }),
85
- meta: {
86
- docs: {
87
- description,
88
- recommended: true,
89
- url
90
- },
91
- schema: [],
92
- type: "problem"
93
- }
94
- });
95
- // Annotate the CommonJS export names for ESM import in node:
96
- 0 && (module.exports = {
97
- noAsyncClientComponent
98
- });
99
- //# sourceMappingURL=no-async-client-component.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/rules/no-async-client-component.ts","../../src/utils/define-rule.ts"],"sourcesContent":["import { defineRule } from \"../utils/define-rule.js\";\n\nconst url = \"https://nextjs.org/docs/messages/no-async-client-component\";\nconst description = \"Prevent client components from being async functions.\";\nconst message = `${description} See: ${url}`;\n\nconst isCapitalized = (str: string): boolean => /[A-Z]/.test(str[0] ?? \"\");\n\nexport const noAsyncClientComponent = defineRule({\n create: (context: any) => ({\n Program: (node: any) => {\n let isClientComponent = false;\n\n for (const block of node.body) {\n if (\n block.type === \"ExpressionStatement\" &&\n block.expression.type === \"Literal\" &&\n block.expression.value === \"use client\"\n ) {\n isClientComponent = true;\n }\n\n if (block.type === \"ExportDefaultDeclaration\" && isClientComponent) {\n // export default async function MyComponent() {...}\n if (\n block.declaration?.type === \"FunctionDeclaration\" &&\n block.declaration.async &&\n isCapitalized(block.declaration.id.name)\n ) {\n context.report({\n message,\n node: block,\n });\n }\n\n // async function MyComponent() {...}; export default MyComponent;\n if (\n block.declaration.type === \"Identifier\" &&\n isCapitalized(block.declaration.name)\n ) {\n const targetName = block.declaration.name;\n\n const functionDeclaration = node.body.find((localBlock: any) => {\n if (\n localBlock.type === \"FunctionDeclaration\" &&\n localBlock.id.name === targetName\n ) {\n return true;\n }\n\n if (\n localBlock.type === \"VariableDeclaration\" &&\n localBlock.declarations.find(\n (declaration: any) =>\n declaration.id?.type === \"Identifier\" &&\n declaration.id.name === targetName,\n )\n ) {\n return true;\n }\n\n return false;\n });\n\n if (\n functionDeclaration?.type === \"FunctionDeclaration\" &&\n functionDeclaration.async\n ) {\n context.report({\n message,\n node: functionDeclaration,\n });\n }\n\n if (functionDeclaration?.type === \"VariableDeclaration\") {\n const varDeclarator = functionDeclaration.declarations.find(\n (declaration: any) =>\n declaration.id?.type === \"Identifier\" &&\n declaration.id.name === targetName,\n );\n\n if (\n varDeclarator?.init?.type === \"ArrowFunctionExpression\" &&\n varDeclarator.init.async\n ) {\n context.report({\n message,\n node: functionDeclaration,\n });\n }\n }\n }\n }\n }\n },\n }),\n\n meta: {\n docs: {\n description,\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n","import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,aAAa,CAAC,SAA2C;;;ADAtE,IAAM,MAAM;AACZ,IAAM,cAAc;AACpB,IAAM,UAAU,GAAG,WAAW,SAAS,GAAG;AAE1C,IAAM,gBAAgB,CAAC,QAAyB,QAAQ,KAAK,IAAI,CAAC,KAAK,EAAE;AAElE,IAAM,yBAAyB,WAAW;AAAA,EAC/C,QAAQ,CAAC,aAAkB;AAAA,IACzB,SAAS,CAAC,SAAc;AACtB,UAAI,oBAAoB;AAExB,iBAAW,SAAS,KAAK,MAAM;AAC7B,YACE,MAAM,SAAS,yBACf,MAAM,WAAW,SAAS,aAC1B,MAAM,WAAW,UAAU,cAC3B;AACA,8BAAoB;AAAA,QACtB;AAEA,YAAI,MAAM,SAAS,8BAA8B,mBAAmB;AAElE,cACE,MAAM,aAAa,SAAS,yBAC5B,MAAM,YAAY,SAClB,cAAc,MAAM,YAAY,GAAG,IAAI,GACvC;AACA,oBAAQ,OAAO;AAAA,cACb;AAAA,cACA,MAAM;AAAA,YACR,CAAC;AAAA,UACH;AAGA,cACE,MAAM,YAAY,SAAS,gBAC3B,cAAc,MAAM,YAAY,IAAI,GACpC;AACA,kBAAM,aAAa,MAAM,YAAY;AAErC,kBAAM,sBAAsB,KAAK,KAAK,KAAK,CAAC,eAAoB;AAC9D,kBACE,WAAW,SAAS,yBACpB,WAAW,GAAG,SAAS,YACvB;AACA,uBAAO;AAAA,cACT;AAEA,kBACE,WAAW,SAAS,yBACpB,WAAW,aAAa;AAAA,gBACtB,CAAC,gBACC,YAAY,IAAI,SAAS,gBACzB,YAAY,GAAG,SAAS;AAAA,cAC5B,GACA;AACA,uBAAO;AAAA,cACT;AAEA,qBAAO;AAAA,YACT,CAAC;AAED,gBACE,qBAAqB,SAAS,yBAC9B,oBAAoB,OACpB;AACA,sBAAQ,OAAO;AAAA,gBACb;AAAA,gBACA,MAAM;AAAA,cACR,CAAC;AAAA,YACH;AAEA,gBAAI,qBAAqB,SAAS,uBAAuB;AACvD,oBAAM,gBAAgB,oBAAoB,aAAa;AAAA,gBACrD,CAAC,gBACC,YAAY,IAAI,SAAS,gBACzB,YAAY,GAAG,SAAS;AAAA,cAC5B;AAEA,kBACE,eAAe,MAAM,SAAS,6BAC9B,cAAc,KAAK,OACnB;AACA,wBAAQ,OAAO;AAAA,kBACb;AAAA,kBACA,MAAM;AAAA,gBACR,CAAC;AAAA,cACH;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":[]}
@@ -1,5 +0,0 @@
1
- import * as eslint from 'eslint';
2
-
3
- declare const noAsyncClientComponent: eslint.Rule.RuleModule;
4
-
5
- export { noAsyncClientComponent };
@@ -1,5 +0,0 @@
1
- import * as eslint from 'eslint';
2
-
3
- declare const noAsyncClientComponent: eslint.Rule.RuleModule;
4
-
5
- export { noAsyncClientComponent };
@@ -1,72 +0,0 @@
1
- // src/utils/define-rule.ts
2
- var defineRule = (rule) => rule;
3
-
4
- // src/rules/no-async-client-component.ts
5
- var url = "https://nextjs.org/docs/messages/no-async-client-component";
6
- var description = "Prevent client components from being async functions.";
7
- var message = `${description} See: ${url}`;
8
- var isCapitalized = (str) => /[A-Z]/.test(str[0] ?? "");
9
- var noAsyncClientComponent = defineRule({
10
- create: (context) => ({
11
- Program: (node) => {
12
- let isClientComponent = false;
13
- for (const block of node.body) {
14
- if (block.type === "ExpressionStatement" && block.expression.type === "Literal" && block.expression.value === "use client") {
15
- isClientComponent = true;
16
- }
17
- if (block.type === "ExportDefaultDeclaration" && isClientComponent) {
18
- if (block.declaration?.type === "FunctionDeclaration" && block.declaration.async && isCapitalized(block.declaration.id.name)) {
19
- context.report({
20
- message,
21
- node: block
22
- });
23
- }
24
- if (block.declaration.type === "Identifier" && isCapitalized(block.declaration.name)) {
25
- const targetName = block.declaration.name;
26
- const functionDeclaration = node.body.find((localBlock) => {
27
- if (localBlock.type === "FunctionDeclaration" && localBlock.id.name === targetName) {
28
- return true;
29
- }
30
- if (localBlock.type === "VariableDeclaration" && localBlock.declarations.find(
31
- (declaration) => declaration.id?.type === "Identifier" && declaration.id.name === targetName
32
- )) {
33
- return true;
34
- }
35
- return false;
36
- });
37
- if (functionDeclaration?.type === "FunctionDeclaration" && functionDeclaration.async) {
38
- context.report({
39
- message,
40
- node: functionDeclaration
41
- });
42
- }
43
- if (functionDeclaration?.type === "VariableDeclaration") {
44
- const varDeclarator = functionDeclaration.declarations.find(
45
- (declaration) => declaration.id?.type === "Identifier" && declaration.id.name === targetName
46
- );
47
- if (varDeclarator?.init?.type === "ArrowFunctionExpression" && varDeclarator.init.async) {
48
- context.report({
49
- message,
50
- node: functionDeclaration
51
- });
52
- }
53
- }
54
- }
55
- }
56
- }
57
- }
58
- }),
59
- meta: {
60
- docs: {
61
- description,
62
- recommended: true,
63
- url
64
- },
65
- schema: [],
66
- type: "problem"
67
- }
68
- });
69
- export {
70
- noAsyncClientComponent
71
- };
72
- //# sourceMappingURL=no-async-client-component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/define-rule.ts","../../src/rules/no-async-client-component.ts"],"sourcesContent":["import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n","import { defineRule } from \"../utils/define-rule.js\";\n\nconst url = \"https://nextjs.org/docs/messages/no-async-client-component\";\nconst description = \"Prevent client components from being async functions.\";\nconst message = `${description} See: ${url}`;\n\nconst isCapitalized = (str: string): boolean => /[A-Z]/.test(str[0] ?? \"\");\n\nexport const noAsyncClientComponent = defineRule({\n create: (context: any) => ({\n Program: (node: any) => {\n let isClientComponent = false;\n\n for (const block of node.body) {\n if (\n block.type === \"ExpressionStatement\" &&\n block.expression.type === \"Literal\" &&\n block.expression.value === \"use client\"\n ) {\n isClientComponent = true;\n }\n\n if (block.type === \"ExportDefaultDeclaration\" && isClientComponent) {\n // export default async function MyComponent() {...}\n if (\n block.declaration?.type === \"FunctionDeclaration\" &&\n block.declaration.async &&\n isCapitalized(block.declaration.id.name)\n ) {\n context.report({\n message,\n node: block,\n });\n }\n\n // async function MyComponent() {...}; export default MyComponent;\n if (\n block.declaration.type === \"Identifier\" &&\n isCapitalized(block.declaration.name)\n ) {\n const targetName = block.declaration.name;\n\n const functionDeclaration = node.body.find((localBlock: any) => {\n if (\n localBlock.type === \"FunctionDeclaration\" &&\n localBlock.id.name === targetName\n ) {\n return true;\n }\n\n if (\n localBlock.type === \"VariableDeclaration\" &&\n localBlock.declarations.find(\n (declaration: any) =>\n declaration.id?.type === \"Identifier\" &&\n declaration.id.name === targetName,\n )\n ) {\n return true;\n }\n\n return false;\n });\n\n if (\n functionDeclaration?.type === \"FunctionDeclaration\" &&\n functionDeclaration.async\n ) {\n context.report({\n message,\n node: functionDeclaration,\n });\n }\n\n if (functionDeclaration?.type === \"VariableDeclaration\") {\n const varDeclarator = functionDeclaration.declarations.find(\n (declaration: any) =>\n declaration.id?.type === \"Identifier\" &&\n declaration.id.name === targetName,\n );\n\n if (\n varDeclarator?.init?.type === \"ArrowFunctionExpression\" &&\n varDeclarator.init.async\n ) {\n context.report({\n message,\n node: functionDeclaration,\n });\n }\n }\n }\n }\n }\n },\n }),\n\n meta: {\n docs: {\n description,\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n"],"mappings":";AAEO,IAAM,aAAa,CAAC,SAA2C;;;ACAtE,IAAM,MAAM;AACZ,IAAM,cAAc;AACpB,IAAM,UAAU,GAAG,WAAW,SAAS,GAAG;AAE1C,IAAM,gBAAgB,CAAC,QAAyB,QAAQ,KAAK,IAAI,CAAC,KAAK,EAAE;AAElE,IAAM,yBAAyB,WAAW;AAAA,EAC/C,QAAQ,CAAC,aAAkB;AAAA,IACzB,SAAS,CAAC,SAAc;AACtB,UAAI,oBAAoB;AAExB,iBAAW,SAAS,KAAK,MAAM;AAC7B,YACE,MAAM,SAAS,yBACf,MAAM,WAAW,SAAS,aAC1B,MAAM,WAAW,UAAU,cAC3B;AACA,8BAAoB;AAAA,QACtB;AAEA,YAAI,MAAM,SAAS,8BAA8B,mBAAmB;AAElE,cACE,MAAM,aAAa,SAAS,yBAC5B,MAAM,YAAY,SAClB,cAAc,MAAM,YAAY,GAAG,IAAI,GACvC;AACA,oBAAQ,OAAO;AAAA,cACb;AAAA,cACA,MAAM;AAAA,YACR,CAAC;AAAA,UACH;AAGA,cACE,MAAM,YAAY,SAAS,gBAC3B,cAAc,MAAM,YAAY,IAAI,GACpC;AACA,kBAAM,aAAa,MAAM,YAAY;AAErC,kBAAM,sBAAsB,KAAK,KAAK,KAAK,CAAC,eAAoB;AAC9D,kBACE,WAAW,SAAS,yBACpB,WAAW,GAAG,SAAS,YACvB;AACA,uBAAO;AAAA,cACT;AAEA,kBACE,WAAW,SAAS,yBACpB,WAAW,aAAa;AAAA,gBACtB,CAAC,gBACC,YAAY,IAAI,SAAS,gBACzB,YAAY,GAAG,SAAS;AAAA,cAC5B,GACA;AACA,uBAAO;AAAA,cACT;AAEA,qBAAO;AAAA,YACT,CAAC;AAED,gBACE,qBAAqB,SAAS,yBAC9B,oBAAoB,OACpB;AACA,sBAAQ,OAAO;AAAA,gBACb;AAAA,gBACA,MAAM;AAAA,cACR,CAAC;AAAA,YACH;AAEA,gBAAI,qBAAqB,SAAS,uBAAuB;AACvD,oBAAM,gBAAgB,oBAAoB,aAAa;AAAA,gBACrD,CAAC,gBACC,YAAY,IAAI,SAAS,gBACzB,YAAY,GAAG,SAAS;AAAA,cAC5B;AAEA,kBACE,eAAe,MAAM,SAAS,6BAC9B,cAAc,KAAK,OACnB;AACA,wBAAQ,OAAO;AAAA,kBACb;AAAA,kBACA,MAAM;AAAA,gBACR,CAAC;AAAA,cACH;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":[]}
@@ -1,94 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/rules/no-before-interactive-script-outside-document.ts
31
- var no_before_interactive_script_outside_document_exports = {};
32
- __export(no_before_interactive_script_outside_document_exports, {
33
- noBeforeInteractiveScriptOutsideDocument: () => noBeforeInteractiveScriptOutsideDocument
34
- });
35
- module.exports = __toCommonJS(no_before_interactive_script_outside_document_exports);
36
- var path = __toESM(require("path"), 1);
37
-
38
- // src/utils/define-rule.ts
39
- var defineRule = (rule) => rule;
40
-
41
- // src/rules/no-before-interactive-script-outside-document.ts
42
- var url = "https://nextjs.org/docs/messages/no-before-interactive-script-outside-document";
43
- var convertToCorrectSeparator = (str) => str.replaceAll(/[/\\]/g, path.sep);
44
- var noBeforeInteractiveScriptOutsideDocument = defineRule({
45
- create: (context) => {
46
- let scriptImportName = null;
47
- return {
48
- 'ImportDeclaration[source.value="next/script"] > ImportDefaultSpecifier'(node) {
49
- scriptImportName = node.local.name;
50
- },
51
- JSXOpeningElement: (node) => {
52
- const pathname = convertToCorrectSeparator(context.filename);
53
- const isInAppDir = pathname.includes(`${path.sep}app${path.sep}`);
54
- if (isInAppDir) {
55
- return;
56
- }
57
- if (!scriptImportName) {
58
- return;
59
- }
60
- if (node.name && node.name.name !== scriptImportName) {
61
- return;
62
- }
63
- const strategy = node.attributes.find(
64
- (child) => child.name && child.name.name === "strategy"
65
- );
66
- if (!strategy?.value || strategy.value.value !== "beforeInteractive") {
67
- return;
68
- }
69
- const document = context.filename.split("pages", 2)[1];
70
- if (document && path.parse(document).name.startsWith("_document")) {
71
- return;
72
- }
73
- context.report({
74
- message: `\`next/script\`'s \`beforeInteractive\` strategy should not be used outside of \`pages/_document.js\`. See: ${url}`,
75
- node
76
- });
77
- }
78
- };
79
- },
80
- meta: {
81
- docs: {
82
- description: "Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.",
83
- recommended: true,
84
- url
85
- },
86
- schema: [],
87
- type: "problem"
88
- }
89
- });
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {
92
- noBeforeInteractiveScriptOutsideDocument
93
- });
94
- //# sourceMappingURL=no-before-interactive-script-outside-document.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/rules/no-before-interactive-script-outside-document.ts","../../src/utils/define-rule.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { defineRule } from \"../utils/define-rule.js\";\n\nconst url =\n \"https://nextjs.org/docs/messages/no-before-interactive-script-outside-document\";\n\nconst convertToCorrectSeparator = (str: string) =>\n str.replaceAll(/[/\\\\]/g, path.sep);\n\nexport const noBeforeInteractiveScriptOutsideDocument = defineRule({\n create: (context: any) => {\n let scriptImportName: null | string = null;\n\n return {\n 'ImportDeclaration[source.value=\"next/script\"] > ImportDefaultSpecifier'(\n node: any,\n ) {\n scriptImportName = node.local.name;\n },\n JSXOpeningElement: (node: any) => {\n const pathname = convertToCorrectSeparator(context.filename);\n\n const isInAppDir = pathname.includes(`${path.sep}app${path.sep}`);\n\n // This rule shouldn't fire in `app/`\n if (isInAppDir) {\n return;\n }\n\n if (!scriptImportName) {\n return;\n }\n\n if (node.name && node.name.name !== scriptImportName) {\n return;\n }\n\n const strategy = node.attributes.find(\n (child: any) => child.name && child.name.name === \"strategy\",\n );\n\n if (!strategy?.value || strategy.value.value !== \"beforeInteractive\") {\n return;\n }\n\n const document = context.filename.split(\"pages\", 2)[1];\n if (document && path.parse(document).name.startsWith(\"_document\")) {\n return;\n }\n\n context.report({\n message: `\\`next/script\\`'s \\`beforeInteractive\\` strategy should not be used outside of \\`pages/_document.js\\`. See: ${url}`,\n node,\n });\n },\n };\n },\n meta: {\n docs: {\n description:\n \"Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.\",\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n","import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;;;ACEf,IAAM,aAAa,CAAC,SAA2C;;;ADEtE,IAAM,MACJ;AAEF,IAAM,4BAA4B,CAAC,QACjC,IAAI,WAAW,UAAe,QAAG;AAE5B,IAAM,2CAA2C,WAAW;AAAA,EACjE,QAAQ,CAAC,YAAiB;AACxB,QAAI,mBAAkC;AAEtC,WAAO;AAAA,MACL,yEACE,MACA;AACA,2BAAmB,KAAK,MAAM;AAAA,MAChC;AAAA,MACA,mBAAmB,CAAC,SAAc;AAChC,cAAM,WAAW,0BAA0B,QAAQ,QAAQ;AAE3D,cAAM,aAAa,SAAS,SAAS,GAAQ,QAAG,MAAW,QAAG,EAAE;AAGhE,YAAI,YAAY;AACd;AAAA,QACF;AAEA,YAAI,CAAC,kBAAkB;AACrB;AAAA,QACF;AAEA,YAAI,KAAK,QAAQ,KAAK,KAAK,SAAS,kBAAkB;AACpD;AAAA,QACF;AAEA,cAAM,WAAW,KAAK,WAAW;AAAA,UAC/B,CAAC,UAAe,MAAM,QAAQ,MAAM,KAAK,SAAS;AAAA,QACpD;AAEA,YAAI,CAAC,UAAU,SAAS,SAAS,MAAM,UAAU,qBAAqB;AACpE;AAAA,QACF;AAEA,cAAM,WAAW,QAAQ,SAAS,MAAM,SAAS,CAAC,EAAE,CAAC;AACrD,YAAI,YAAiB,WAAM,QAAQ,EAAE,KAAK,WAAW,WAAW,GAAG;AACjE;AAAA,QACF;AAEA,gBAAQ,OAAO;AAAA,UACb,SAAS,+GAA+G,GAAG;AAAA,UAC3H;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,aACE;AAAA,MACF,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":[]}
@@ -1,5 +0,0 @@
1
- import * as eslint from 'eslint';
2
-
3
- declare const noBeforeInteractiveScriptOutsideDocument: eslint.Rule.RuleModule;
4
-
5
- export { noBeforeInteractiveScriptOutsideDocument };
@@ -1,5 +0,0 @@
1
- import * as eslint from 'eslint';
2
-
3
- declare const noBeforeInteractiveScriptOutsideDocument: eslint.Rule.RuleModule;
4
-
5
- export { noBeforeInteractiveScriptOutsideDocument };
@@ -1,59 +0,0 @@
1
- // src/rules/no-before-interactive-script-outside-document.ts
2
- import * as path from "node:path";
3
-
4
- // src/utils/define-rule.ts
5
- var defineRule = (rule) => rule;
6
-
7
- // src/rules/no-before-interactive-script-outside-document.ts
8
- var url = "https://nextjs.org/docs/messages/no-before-interactive-script-outside-document";
9
- var convertToCorrectSeparator = (str) => str.replaceAll(/[/\\]/g, path.sep);
10
- var noBeforeInteractiveScriptOutsideDocument = defineRule({
11
- create: (context) => {
12
- let scriptImportName = null;
13
- return {
14
- 'ImportDeclaration[source.value="next/script"] > ImportDefaultSpecifier'(node) {
15
- scriptImportName = node.local.name;
16
- },
17
- JSXOpeningElement: (node) => {
18
- const pathname = convertToCorrectSeparator(context.filename);
19
- const isInAppDir = pathname.includes(`${path.sep}app${path.sep}`);
20
- if (isInAppDir) {
21
- return;
22
- }
23
- if (!scriptImportName) {
24
- return;
25
- }
26
- if (node.name && node.name.name !== scriptImportName) {
27
- return;
28
- }
29
- const strategy = node.attributes.find(
30
- (child) => child.name && child.name.name === "strategy"
31
- );
32
- if (!strategy?.value || strategy.value.value !== "beforeInteractive") {
33
- return;
34
- }
35
- const document = context.filename.split("pages", 2)[1];
36
- if (document && path.parse(document).name.startsWith("_document")) {
37
- return;
38
- }
39
- context.report({
40
- message: `\`next/script\`'s \`beforeInteractive\` strategy should not be used outside of \`pages/_document.js\`. See: ${url}`,
41
- node
42
- });
43
- }
44
- };
45
- },
46
- meta: {
47
- docs: {
48
- description: "Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.",
49
- recommended: true,
50
- url
51
- },
52
- schema: [],
53
- type: "problem"
54
- }
55
- });
56
- export {
57
- noBeforeInteractiveScriptOutsideDocument
58
- };
59
- //# sourceMappingURL=no-before-interactive-script-outside-document.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/rules/no-before-interactive-script-outside-document.ts","../../src/utils/define-rule.ts"],"sourcesContent":["import * as path from \"node:path\";\n\nimport { defineRule } from \"../utils/define-rule.js\";\n\nconst url =\n \"https://nextjs.org/docs/messages/no-before-interactive-script-outside-document\";\n\nconst convertToCorrectSeparator = (str: string) =>\n str.replaceAll(/[/\\\\]/g, path.sep);\n\nexport const noBeforeInteractiveScriptOutsideDocument = defineRule({\n create: (context: any) => {\n let scriptImportName: null | string = null;\n\n return {\n 'ImportDeclaration[source.value=\"next/script\"] > ImportDefaultSpecifier'(\n node: any,\n ) {\n scriptImportName = node.local.name;\n },\n JSXOpeningElement: (node: any) => {\n const pathname = convertToCorrectSeparator(context.filename);\n\n const isInAppDir = pathname.includes(`${path.sep}app${path.sep}`);\n\n // This rule shouldn't fire in `app/`\n if (isInAppDir) {\n return;\n }\n\n if (!scriptImportName) {\n return;\n }\n\n if (node.name && node.name.name !== scriptImportName) {\n return;\n }\n\n const strategy = node.attributes.find(\n (child: any) => child.name && child.name.name === \"strategy\",\n );\n\n if (!strategy?.value || strategy.value.value !== \"beforeInteractive\") {\n return;\n }\n\n const document = context.filename.split(\"pages\", 2)[1];\n if (document && path.parse(document).name.startsWith(\"_document\")) {\n return;\n }\n\n context.report({\n message: `\\`next/script\\`'s \\`beforeInteractive\\` strategy should not be used outside of \\`pages/_document.js\\`. See: ${url}`,\n node,\n });\n },\n };\n },\n meta: {\n docs: {\n description:\n \"Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.\",\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n","import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n"],"mappings":";AAAA,YAAY,UAAU;;;ACEf,IAAM,aAAa,CAAC,SAA2C;;;ADEtE,IAAM,MACJ;AAEF,IAAM,4BAA4B,CAAC,QACjC,IAAI,WAAW,UAAe,QAAG;AAE5B,IAAM,2CAA2C,WAAW;AAAA,EACjE,QAAQ,CAAC,YAAiB;AACxB,QAAI,mBAAkC;AAEtC,WAAO;AAAA,MACL,yEACE,MACA;AACA,2BAAmB,KAAK,MAAM;AAAA,MAChC;AAAA,MACA,mBAAmB,CAAC,SAAc;AAChC,cAAM,WAAW,0BAA0B,QAAQ,QAAQ;AAE3D,cAAM,aAAa,SAAS,SAAS,GAAQ,QAAG,MAAW,QAAG,EAAE;AAGhE,YAAI,YAAY;AACd;AAAA,QACF;AAEA,YAAI,CAAC,kBAAkB;AACrB;AAAA,QACF;AAEA,YAAI,KAAK,QAAQ,KAAK,KAAK,SAAS,kBAAkB;AACpD;AAAA,QACF;AAEA,cAAM,WAAW,KAAK,WAAW;AAAA,UAC/B,CAAC,UAAe,MAAM,QAAQ,MAAM,KAAK,SAAS;AAAA,QACpD;AAEA,YAAI,CAAC,UAAU,SAAS,SAAS,MAAM,UAAU,qBAAqB;AACpE;AAAA,QACF;AAEA,cAAM,WAAW,QAAQ,SAAS,MAAM,SAAS,CAAC,EAAE,CAAC;AACrD,YAAI,YAAiB,WAAM,QAAQ,EAAE,KAAK,WAAW,WAAW,GAAG;AACjE;AAAA,QACF;AAEA,gBAAQ,OAAO;AAAA,UACb,SAAS,+GAA+G,GAAG;AAAA,UAC3H;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,aACE;AAAA,MACF,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":[]}
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/rules/no-css-tags.ts
21
- var no_css_tags_exports = {};
22
- __export(no_css_tags_exports, {
23
- noCssTags: () => noCssTags
24
- });
25
- module.exports = __toCommonJS(no_css_tags_exports);
26
-
27
- // src/utils/define-rule.ts
28
- var defineRule = (rule) => rule;
29
-
30
- // src/rules/no-css-tags.ts
31
- var url = "https://nextjs.org/docs/messages/no-css-tags";
32
- var noCssTags = defineRule({
33
- create: (context) => ({
34
- JSXOpeningElement: (node) => {
35
- if (node.name.name !== "link") {
36
- return;
37
- }
38
- if (node.attributes.length === 0) {
39
- return;
40
- }
41
- const attributes = node.attributes.filter(
42
- (attr) => attr.type === "JSXAttribute"
43
- );
44
- if (attributes.find(
45
- (attr) => attr.name.name === "rel" && attr.value.value === "stylesheet"
46
- ) && attributes.find(
47
- (attr) => attr.name.name === "href" && attr.value.type === "Literal" && !/^https?/.test(attr.value.value)
48
- )) {
49
- context.report({
50
- message: `Do not include stylesheets manually. See: ${url}`,
51
- node
52
- });
53
- }
54
- }
55
- }),
56
- meta: {
57
- docs: {
58
- description: "Prevent manual stylesheet tags.",
59
- recommended: true,
60
- url
61
- },
62
- schema: [],
63
- type: "problem"
64
- }
65
- });
66
- // Annotate the CommonJS export names for ESM import in node:
67
- 0 && (module.exports = {
68
- noCssTags
69
- });
70
- //# sourceMappingURL=no-css-tags.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/rules/no-css-tags.ts","../../src/utils/define-rule.ts"],"sourcesContent":["import { defineRule } from \"../utils/define-rule.js\";\nconst url = \"https://nextjs.org/docs/messages/no-css-tags\";\n\nexport const noCssTags = defineRule({\n create: (context: any) => ({\n JSXOpeningElement: (node: any) => {\n if (node.name.name !== \"link\") {\n return;\n }\n if (node.attributes.length === 0) {\n return;\n }\n\n const attributes = node.attributes.filter(\n (attr: any) => attr.type === \"JSXAttribute\",\n );\n if (\n attributes.find(\n (attr: any) =>\n attr.name.name === \"rel\" && attr.value.value === \"stylesheet\",\n ) &&\n attributes.find(\n (attr: any) =>\n attr.name.name === \"href\" &&\n attr.value.type === \"Literal\" &&\n !/^https?/.test(attr.value.value),\n )\n ) {\n context.report({\n message: `Do not include stylesheets manually. See: ${url}`,\n node,\n });\n }\n },\n }),\n meta: {\n docs: {\n description: \"Prevent manual stylesheet tags.\",\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n","import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,aAAa,CAAC,SAA2C;;;ADDtE,IAAM,MAAM;AAEL,IAAM,YAAY,WAAW;AAAA,EAClC,QAAQ,CAAC,aAAkB;AAAA,IACzB,mBAAmB,CAAC,SAAc;AAChC,UAAI,KAAK,KAAK,SAAS,QAAQ;AAC7B;AAAA,MACF;AACA,UAAI,KAAK,WAAW,WAAW,GAAG;AAChC;AAAA,MACF;AAEA,YAAM,aAAa,KAAK,WAAW;AAAA,QACjC,CAAC,SAAc,KAAK,SAAS;AAAA,MAC/B;AACA,UACE,WAAW;AAAA,QACT,CAAC,SACC,KAAK,KAAK,SAAS,SAAS,KAAK,MAAM,UAAU;AAAA,MACrD,KACA,WAAW;AAAA,QACT,CAAC,SACC,KAAK,KAAK,SAAS,UACnB,KAAK,MAAM,SAAS,aACpB,CAAC,UAAU,KAAK,KAAK,MAAM,KAAK;AAAA,MACpC,GACA;AACA,gBAAQ,OAAO;AAAA,UACb,SAAS,6CAA6C,GAAG;AAAA,UACzD;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":[]}
@@ -1,5 +0,0 @@
1
- import * as eslint from 'eslint';
2
-
3
- declare const noCssTags: eslint.Rule.RuleModule;
4
-
5
- export { noCssTags };
@@ -1,5 +0,0 @@
1
- import * as eslint from 'eslint';
2
-
3
- declare const noCssTags: eslint.Rule.RuleModule;
4
-
5
- export { noCssTags };
@@ -1,43 +0,0 @@
1
- // src/utils/define-rule.ts
2
- var defineRule = (rule) => rule;
3
-
4
- // src/rules/no-css-tags.ts
5
- var url = "https://nextjs.org/docs/messages/no-css-tags";
6
- var noCssTags = defineRule({
7
- create: (context) => ({
8
- JSXOpeningElement: (node) => {
9
- if (node.name.name !== "link") {
10
- return;
11
- }
12
- if (node.attributes.length === 0) {
13
- return;
14
- }
15
- const attributes = node.attributes.filter(
16
- (attr) => attr.type === "JSXAttribute"
17
- );
18
- if (attributes.find(
19
- (attr) => attr.name.name === "rel" && attr.value.value === "stylesheet"
20
- ) && attributes.find(
21
- (attr) => attr.name.name === "href" && attr.value.type === "Literal" && !/^https?/.test(attr.value.value)
22
- )) {
23
- context.report({
24
- message: `Do not include stylesheets manually. See: ${url}`,
25
- node
26
- });
27
- }
28
- }
29
- }),
30
- meta: {
31
- docs: {
32
- description: "Prevent manual stylesheet tags.",
33
- recommended: true,
34
- url
35
- },
36
- schema: [],
37
- type: "problem"
38
- }
39
- });
40
- export {
41
- noCssTags
42
- };
43
- //# sourceMappingURL=no-css-tags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/define-rule.ts","../../src/rules/no-css-tags.ts"],"sourcesContent":["import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n","import { defineRule } from \"../utils/define-rule.js\";\nconst url = \"https://nextjs.org/docs/messages/no-css-tags\";\n\nexport const noCssTags = defineRule({\n create: (context: any) => ({\n JSXOpeningElement: (node: any) => {\n if (node.name.name !== \"link\") {\n return;\n }\n if (node.attributes.length === 0) {\n return;\n }\n\n const attributes = node.attributes.filter(\n (attr: any) => attr.type === \"JSXAttribute\",\n );\n if (\n attributes.find(\n (attr: any) =>\n attr.name.name === \"rel\" && attr.value.value === \"stylesheet\",\n ) &&\n attributes.find(\n (attr: any) =>\n attr.name.name === \"href\" &&\n attr.value.type === \"Literal\" &&\n !/^https?/.test(attr.value.value),\n )\n ) {\n context.report({\n message: `Do not include stylesheets manually. See: ${url}`,\n node,\n });\n }\n },\n }),\n meta: {\n docs: {\n description: \"Prevent manual stylesheet tags.\",\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n"],"mappings":";AAEO,IAAM,aAAa,CAAC,SAA2C;;;ACDtE,IAAM,MAAM;AAEL,IAAM,YAAY,WAAW;AAAA,EAClC,QAAQ,CAAC,aAAkB;AAAA,IACzB,mBAAmB,CAAC,SAAc;AAChC,UAAI,KAAK,KAAK,SAAS,QAAQ;AAC7B;AAAA,MACF;AACA,UAAI,KAAK,WAAW,WAAW,GAAG;AAChC;AAAA,MACF;AAEA,YAAM,aAAa,KAAK,WAAW;AAAA,QACjC,CAAC,SAAc,KAAK,SAAS;AAAA,MAC/B;AACA,UACE,WAAW;AAAA,QACT,CAAC,SACC,KAAK,KAAK,SAAS,SAAS,KAAK,MAAM,UAAU;AAAA,MACrD,KACA,WAAW;AAAA,QACT,CAAC,SACC,KAAK,KAAK,SAAS,UACnB,KAAK,MAAM,SAAS,aACpB,CAAC,UAAU,KAAK,KAAK,MAAM,KAAK;AAAA,MACpC,GACA;AACA,gBAAQ,OAAO;AAAA,UACb,SAAS,6CAA6C,GAAG;AAAA,UACzD;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":[]}