@friendsoftheweb/eslint-plugin 0.0.3-beta.0 → 0.0.3-beta.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/README.md CHANGED
@@ -8,14 +8,16 @@ yarn add -D @friendsoftheweb/eslint-plugin
8
8
 
9
9
  ## Rules
10
10
 
11
- ### `friendsoftheweb/ban-lodash-import`
11
+ ### Recommended Rules
12
+
13
+ #### `friendsoftheweb/ban-lodash-import`
12
14
 
13
15
  Enforces importing functions from `lodash-es` instead of `lodash`.
14
16
 
15
17
  This rule helps ensure tree shaking works properly by preferring ES module
16
18
  imports from `lodash-es` over CommonJS imports from `lodash`.
17
19
 
18
- #### Examples
20
+ ##### Examples
19
21
 
20
22
  ❌ **Incorrect:**
21
23
 
@@ -35,12 +37,12 @@ import debounce from 'lodash-es/debounce';
35
37
  **Note:** This rule provides automatic fixes for most cases, except for
36
38
  `lodash/fp` imports which require manual migration.
37
39
 
38
- ### `friendsoftheweb/css-module-class-exists`
40
+ #### `friendsoftheweb/css-module-class-exists`
39
41
 
40
42
  Enforces that class names used from an imported CSS module exist in the module
41
43
  file.
42
44
 
43
- ### `friendsoftheweb/css-module-name-matches`
45
+ #### `friendsoftheweb/css-module-name-matches`
44
46
 
45
47
  Enforces that a CSS module's filename matches the filename of the importing
46
48
  file.
@@ -48,7 +50,7 @@ file.
48
50
  This rule ensures consistent naming conventions by requiring CSS module files to
49
51
  have the same base name as the file importing them.
50
52
 
51
- ### `friendsoftheweb/valid-server-actions-path`
53
+ #### `friendsoftheweb/valid-server-actions-path`
52
54
 
53
55
  Enforces server actions are exported from file paths that match
54
56
  `app/**/_actions.ts` or `app/**/_actions/**/*.ts`.
@@ -56,12 +58,80 @@ Enforces server actions are exported from file paths that match
56
58
  This rule helps maintain a consistent file structure for Next.js server actions
57
59
  by ensuring they are placed in designated locations.
58
60
 
61
+ ### Future Rules
62
+
63
+ #### `friendsoftheweb/react-named-func-components`
64
+
65
+ Enforces using named functions when defining React components instead of arrow
66
+ functions. Component definitions that are wrapped in a function call (e.g.
67
+ `forwardRef()`) are allowed to use arrow functions.
68
+
69
+ This rule promotes better debugging and development experience by ensuring React
70
+ components are defined as named functions, which provide clearer stack traces
71
+ and better display names in React DevTools.
72
+
73
+ ##### Examples
74
+
75
+ ❌ **Incorrect:**
76
+
77
+ ```tsx
78
+ const Button: FC<PropsWithChildren> = (props) => {
79
+ const { children } = props;
80
+
81
+ return <button>{children}</button>;
82
+ };
83
+ ```
84
+
85
+ ✅ **Correct:**
86
+
87
+ ```tsx
88
+ function Button(props: PropsWithChildren) {
89
+ const { children } = props;
90
+
91
+ return <button>{children}</button>;
92
+ }
93
+ ```
94
+
95
+ ```tsx
96
+ const Button = forwardRef<HTMLButtonElement, PropsWithChildren>(
97
+ (props, ref) => {
98
+ const { children } = props;
99
+
100
+ return <button ref={ref}>{children}</button>;
101
+ },
102
+ );
103
+
104
+ Button.displayName = 'Button';
105
+ ```
106
+
59
107
  ## Example Configurations
60
108
 
61
- ### Basic Example
109
+ ### Recommended Configuration
110
+
111
+ ```javascript
112
+ import friendsOfTheWeb from '@friendsoftheweb/eslint-plugin';
113
+ import { defineConfig } from 'eslint/config';
114
+ import tseslint from 'typescript-eslint';
115
+
116
+ export default defineConfig([
117
+ { ignores: ['.yarn/**/*'] },
118
+ {
119
+ files: ['**/*.{js,jsx,ts,tsx}'],
120
+ extends: [
121
+ tseslint.configs.recommended,
122
+ friendsOfTheWeb.configs['flat/recommended'],
123
+ ],
124
+ },
125
+ ]);
126
+ ```
127
+
128
+ #### Recommended Configuration with React
62
129
 
63
130
  ```javascript
64
131
  import friendsOfTheWeb from '@friendsoftheweb/eslint-plugin';
132
+ import react from 'eslint-plugin-react';
133
+ import reactCompiler from 'eslint-plugin-react-compiler';
134
+ import reactHooks from 'eslint-plugin-react-hooks';
65
135
  import { defineConfig } from 'eslint/config';
66
136
  import tseslint from 'typescript-eslint';
67
137
 
@@ -71,13 +141,22 @@ export default defineConfig([
71
141
  files: ['**/*.{js,jsx,ts,tsx}'],
72
142
  extends: [
73
143
  tseslint.configs.recommended,
144
+ react.configs.flat.recommended,
145
+ react.configs.flat['jsx-runtime'],
146
+ reactHooks.configs.flat.recommended,
147
+ reactCompiler.configs.recommended,
74
148
  friendsOfTheWeb.configs['flat/recommended'],
75
149
  ],
150
+ settings: {
151
+ react: {
152
+ version: 'detect',
153
+ },
154
+ },
76
155
  },
77
156
  ]);
78
157
  ```
79
158
 
80
- ### Gradual Adoption
159
+ #### Gradual Adoption
81
160
 
82
161
  There is an additional configuration that makes it easier to adopt this plugin
83
162
  by only warning about violations.
@@ -99,13 +178,16 @@ export default defineConfig([
99
178
  ]);
100
179
  ```
101
180
 
102
- ### Example with React
181
+ ### Future Configuration
182
+
183
+ This configuration includes all of the [recommended rules](#recommended-rules)
184
+ and [additional rules](#future-rules) that will be considered violations in the
185
+ future.
186
+
187
+ Future rule violations are considered warnings with this configuration.
103
188
 
104
189
  ```javascript
105
190
  import friendsOfTheWeb from '@friendsoftheweb/eslint-plugin';
106
- import react from 'eslint-plugin-react';
107
- import reactCompiler from 'eslint-plugin-react-compiler';
108
- import reactHooks from 'eslint-plugin-react-hooks';
109
191
  import { defineConfig } from 'eslint/config';
110
192
  import tseslint from 'typescript-eslint';
111
193
 
@@ -115,17 +197,8 @@ export default defineConfig([
115
197
  files: ['**/*.{js,jsx,ts,tsx}'],
116
198
  extends: [
117
199
  tseslint.configs.recommended,
118
- react.configs.flat.recommended,
119
- react.configs.flat['jsx-runtime'],
120
- reactHooks.configs.flat.recommended,
121
- reactCompiler.configs.recommended,
122
- friendsOfTheWeb.configs['flat/recommended'],
200
+ friendsOfTheWeb.configs['flat/future'],
123
201
  ],
124
- settings: {
125
- react: {
126
- version: 'detect',
127
- },
128
- },
129
202
  },
130
203
  ]);
131
204
  ```
package/dist/cjs/index.js CHANGED
@@ -6,13 +6,12 @@ var postcss = require('postcss');
6
6
  var selectorParser = require('postcss-selector-parser');
7
7
 
8
8
  var name = "@friendsoftheweb/eslint-plugin";
9
- var version = "0.0.3-beta.0";
9
+ var version = "0.0.3-beta.1";
10
10
  var packageJson = {
11
11
  name: name,
12
12
  version: version};
13
13
 
14
- /** @type {import('eslint').JSRuleDefinition} */
15
- var banLodashImport = {
14
+ const banLodashImportRule = {
16
15
  meta: {
17
16
  type: 'problem',
18
17
  fixable: 'code',
@@ -25,6 +24,7 @@ var banLodashImport = {
25
24
  invalidImport: 'Functions must be imported from "lodash-es" instead of "lodash"',
26
25
  },
27
26
  },
27
+ defaultOptions: [],
28
28
  create(context) {
29
29
  return {
30
30
  ImportDeclaration(node) {
@@ -55,8 +55,7 @@ var banLodashImport = {
55
55
  },
56
56
  };
57
57
 
58
- /** @type {import('eslint').JSRuleDefinition} */
59
- var cssModuleNameMatchesRule = {
58
+ const cssModuleNameMatchesRule = {
60
59
  meta: {
61
60
  type: 'problem',
62
61
  docs: {
@@ -68,6 +67,7 @@ var cssModuleNameMatchesRule = {
68
67
  filenameMismatch: 'CSS module filename "{{cssModuleFilename}}" does not match the current filename "{{filename}}"',
69
68
  },
70
69
  },
70
+ defaultOptions: [],
71
71
  create(context) {
72
72
  return {
73
73
  ImportDeclaration(node) {
@@ -93,8 +93,7 @@ var cssModuleNameMatchesRule = {
93
93
  },
94
94
  };
95
95
 
96
- /** @type {import('eslint').JSRuleDefinition} */
97
- var cssModuleClassExistsRule = {
96
+ const cssModuleClassExistsRule = {
98
97
  meta: {
99
98
  type: 'problem',
100
99
  docs: {
@@ -110,6 +109,7 @@ var cssModuleClassExistsRule = {
110
109
  classDoesNotExist: 'Class `.{{className}}` does not exist in the CSS module imported as `{{objectName}}`',
111
110
  },
112
111
  },
112
+ defaultOptions: [],
113
113
  create(context) {
114
114
  const classNames = {};
115
115
  return {
@@ -255,8 +255,7 @@ var cssModuleClassExistsRule = {
255
255
  },
256
256
  };
257
257
 
258
- /** @type {import('eslint').JSRuleDefinition} */
259
- var noLegacyNodeImport = {
258
+ const noLegacyNodeImportRule = {
260
259
  meta: {
261
260
  type: 'problem',
262
261
  fixable: 'code',
@@ -266,9 +265,10 @@ var noLegacyNodeImport = {
266
265
  },
267
266
  schema: [],
268
267
  messages: {
269
- invalidImport: 'Node standard library modules must be imported using the "node:" prefix (e.g. "node:{{moduleName}}")',
268
+ invalidImport: 'Node standard library modules must be imported using the "node:" prefix',
270
269
  },
271
270
  },
271
+ defaultOptions: [],
272
272
  create(context) {
273
273
  return {
274
274
  ImportDeclaration(node) {
@@ -279,7 +279,6 @@ var noLegacyNodeImport = {
279
279
  context.report({
280
280
  node,
281
281
  messageId: 'invalidImport',
282
- data: { moduleName: node.source.value },
283
282
  fix(fixer) {
284
283
  if (typeof node.source.value !== 'string') {
285
284
  return null;
@@ -343,8 +342,68 @@ const NODE_STANDARD_MODULES = Object.freeze([
343
342
  'zlib',
344
343
  ]);
345
344
 
346
- /** @type {import('eslint').JSRuleDefinition} */
347
- var validServerActionsPathRule = {
345
+ const reactNamedFuncComponentsRule = {
346
+ meta: {
347
+ type: 'problem',
348
+ docs: {
349
+ description: 'enforce use of named functions when defining React components',
350
+ url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebreact-named-func-components',
351
+ },
352
+ schema: [],
353
+ messages: {
354
+ invalidComponentDefinition: 'React components must be defined using named functions',
355
+ },
356
+ },
357
+ defaultOptions: [],
358
+ create(context) {
359
+ return {
360
+ VariableDeclarator(node) {
361
+ if (!isReactComponent(node)) {
362
+ return;
363
+ }
364
+ context.report({
365
+ node,
366
+ messageId: 'invalidComponentDefinition',
367
+ });
368
+ },
369
+ };
370
+ },
371
+ };
372
+ function isReactComponent(node) {
373
+ if (node.type === 'VariableDeclarator') {
374
+ if (node.init == null) {
375
+ return false;
376
+ }
377
+ if (node.init.type !== 'ArrowFunctionExpression') {
378
+ return false;
379
+ }
380
+ if (node.id.type !== 'Identifier' || !/^[A-Z]/.test(node.id.name)) {
381
+ return false;
382
+ }
383
+ return isReactComponent(node.init);
384
+ }
385
+ else if (node.type === 'FunctionDeclaration') {
386
+ if (node.id != null && !/^[A-Z]/.test(node.id.name)) {
387
+ return false;
388
+ }
389
+ }
390
+ if (node.body.type !== 'BlockStatement') {
391
+ return false;
392
+ }
393
+ for (const statement of node.body.body) {
394
+ if (statement.type === 'ReturnStatement' &&
395
+ statement.argument != null &&
396
+ // @ts-expect-error: ESTree types are missing JSXElement
397
+ (statement.argument.type === 'JSXElement' ||
398
+ (statement.argument.type === 'Literal' &&
399
+ statement.argument.value === null))) {
400
+ return true;
401
+ }
402
+ }
403
+ return false;
404
+ }
405
+
406
+ const validServerActionsPathRule = {
348
407
  meta: {
349
408
  type: 'problem',
350
409
  docs: {
@@ -356,6 +415,7 @@ var validServerActionsPathRule = {
356
415
  invalidPath: 'Server action files must be located in a directory named "_actions" or have the filename "_actions.ts"',
357
416
  },
358
417
  },
418
+ defaultOptions: [],
359
419
  create(context) {
360
420
  return {
361
421
  ExpressionStatement(node) {
@@ -381,7 +441,6 @@ var validServerActionsPathRule = {
381
441
  },
382
442
  };
383
443
 
384
- /** @type {import('eslint').ESLint.Plugin} */
385
444
  const plugin = {
386
445
  meta: {
387
446
  name: packageJson.name,
@@ -389,10 +448,11 @@ const plugin = {
389
448
  },
390
449
  configs: {},
391
450
  rules: {
392
- 'ban-lodash-import': banLodashImport,
451
+ 'ban-lodash-import': banLodashImportRule,
393
452
  'css-module-name-matches': cssModuleNameMatchesRule,
394
453
  'css-module-class-exists': cssModuleClassExistsRule,
395
- 'no-legacy-node-import': noLegacyNodeImport,
454
+ 'no-legacy-node-import': noLegacyNodeImportRule,
455
+ 'react-named-func-components': reactNamedFuncComponentsRule,
396
456
  'valid-server-actions-path': validServerActionsPathRule,
397
457
  },
398
458
  };
@@ -408,11 +468,18 @@ function buildConfig(reportLevel) {
408
468
  rules: Object.fromEntries(RULE_NAMES.map((ruleName) => [ruleName, reportLevel])),
409
469
  };
410
470
  }
471
+ const errorConfig = buildConfig('error');
472
+ const warnConfig = buildConfig('warn');
473
+ const futureConfig = Object.assign(Object.assign({}, errorConfig), { rules: Object.assign(Object.assign({}, errorConfig.rules), { 'friendsoftheweb/react-named-func-components': 'warn' }) });
474
+ const recommendedConfig = Object.assign(Object.assign({}, errorConfig), { rules: Object.assign(Object.assign({}, errorConfig.rules), { 'friendsoftheweb/react-named-func-components': 'off' }) });
475
+ const migrateConfig = Object.assign(Object.assign({}, warnConfig), { rules: Object.assign(Object.assign({}, warnConfig.rules), { 'friendsoftheweb/react-named-func-components': 'off' }) });
411
476
  Object.assign(plugin.configs, {
412
- 'flat/recommended': [buildConfig('error')],
413
- 'flat/migrate': [buildConfig('warn')],
414
- recommended: buildConfig('error'),
415
- migrate: buildConfig('warn'),
477
+ 'flat/future': [futureConfig],
478
+ 'flat/recommended': [recommendedConfig],
479
+ 'flat/migrate': [migrateConfig],
480
+ future: futureConfig,
481
+ recommended: recommendedConfig,
482
+ migrate: migrateConfig,
416
483
  });
417
484
 
418
485
  module.exports = plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/rules/ban-lodash-import.mjs","../../../../src/rules/css-module-name-matches.mjs","../../../../src/rules/css-module-class-exists.mjs","../../../../src/rules/no-legacy-node-import.mjs","../../../../src/rules/valid-server-actions-path.mjs","../../../../src/index.mjs"],"sourcesContent":["/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description:\n 'enforce importing functions from `lodash-es` instead of `lodash`',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebban-lodash-import',\n },\n schema: [],\n messages: {\n invalidImport:\n 'Functions must be imported from \"lodash-es\" instead of \"lodash\"',\n },\n },\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n (node.source.value !== 'lodash' &&\n !node.source.value.startsWith('lodash/'))\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidImport',\n fix(fixer) {\n if (typeof node.source.value !== 'string') {\n return null;\n }\n\n if (node.source.value === 'lodash/fp') {\n return null; // no automatic fix for fp imports\n }\n\n const newImportPath =\n node.source.value === 'lodash'\n ? 'lodash-es'\n : node.source.value.replace(/^lodash\\//, 'lodash-es/');\n\n const quote = node.source.raw[0]; // preserve original quote style\n\n return fixer.replaceText(\n node.source,\n `${quote}${newImportPath}${quote}`,\n );\n },\n });\n },\n };\n },\n};\n","import path from 'node:path';\n\n/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n docs: {\n description:\n \"enforce that a CSS module's filename matches the filename of the importing file\",\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-name-matches',\n },\n schema: [],\n messages: {\n filenameMismatch:\n 'CSS module filename \"{{cssModuleFilename}}\" does not match the current filename \"{{filename}}\"',\n },\n },\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !node.source.value.endsWith('.module.css')\n ) {\n return;\n }\n\n const filename = path.basename(\n context.filename,\n path.extname(context.filename),\n );\n\n const cssModulePath = node.source.value;\n const cssModuleFilename = path.basename(cssModulePath, '.module.css');\n\n if (cssModuleFilename !== filename) {\n context.report({\n node,\n messageId: 'filenameMismatch',\n data: {\n cssModuleFilename,\n filename,\n },\n });\n }\n },\n };\n },\n};\n","import path from 'node:path';\nimport fs from 'node:fs';\n\nimport { parse } from 'postcss';\nimport selectorParser from 'postcss-selector-parser';\n\n/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce that class names used from an imported CSS module exist in the module file',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-class-exists',\n },\n schema: [],\n messages: {\n relativePath:\n 'CSS module import \"{{importPath}}\" should be a relative path',\n defaultImport:\n 'CSS module import \"{{importPath}}\" should have a default import',\n onlyDefaultImport:\n 'CSS module import \"{{importPath}}\" should have only a default import',\n fileDoesNotExist:\n 'CSS module file \"{{absoluteImportPath}}\" does not exist',\n classDoesNotExist:\n 'Class `.{{className}}` does not exist in the CSS module imported as `{{objectName}}`',\n },\n },\n create(context) {\n const classNames = {};\n\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !node.source.value.endsWith('.module.css')\n ) {\n return;\n }\n\n const importPath = node.source.value;\n\n if (!(importPath.startsWith('./') || importPath.startsWith('../'))) {\n context.report({\n node,\n messageId: 'relativePath',\n data: { importPath },\n });\n\n return;\n }\n\n if (node.specifiers.length === 0) {\n context.report({\n node,\n messageId: 'defaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n if (node.specifiers.length > 1) {\n context.report({\n node,\n messageId: 'onlyDefaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n const defaultImportSpecifier = node.specifiers.find(\n (specifier) => specifier.type === 'ImportDefaultSpecifier',\n );\n\n if (defaultImportSpecifier == null) {\n context.report({\n node,\n messageId: 'onlyDefaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n const dirname = path.dirname(context.physicalFilename);\n const absoluteImportPath = path.resolve(dirname, importPath);\n\n if (!fs.existsSync(absoluteImportPath)) {\n context.report({\n node,\n messageId: 'fileDoesNotExist',\n data: { absoluteImportPath },\n });\n\n return;\n }\n\n const importName = defaultImportSpecifier.local.name;\n\n classNames[importName] = new Set();\n\n const cssModuleContent = fs.readFileSync(absoluteImportPath, 'utf8');\n const root = parse(cssModuleContent);\n\n for (const node of root.nodes) {\n if (node.type === 'rule') {\n selectorParser(function transform(selectors) {\n selectors.walkClasses((classNode) => {\n classNames[importName].add(classNode.value);\n });\n }).processSync(node.selector);\n } else if (\n node.type === 'atrule' &&\n (node.name === 'media' ||\n node.name === 'container' ||\n node.name === 'layer')\n ) {\n for (const childNode of node.nodes) {\n if (childNode.type !== 'rule') {\n continue;\n }\n\n selectorParser(function transform(selectors) {\n selectors.walkClasses((classNode) => {\n classNames[importName].add(classNode.value);\n });\n }).processSync(childNode.selector);\n }\n }\n }\n },\n MemberExpression(node) {\n if (node.object.type !== 'Identifier') {\n return;\n }\n\n if (classNames[node.object.name] == null) {\n return;\n }\n\n const objectName = node.object.name;\n\n if (node.property.type === 'Identifier') {\n const className = node.property.name;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n\n return;\n }\n\n if (\n node.property.type === 'Literal' &&\n typeof node.property.value === 'string'\n ) {\n const className = node.property.value;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n }\n },\n VariableDeclarator(node) {\n if (node.id.type !== 'ObjectPattern') {\n return;\n }\n\n if (node.init?.type !== 'Identifier') {\n return;\n }\n\n const objectName = node.init.name;\n\n if (classNames[objectName] == null) {\n return;\n }\n\n for (const property of node.id.properties) {\n if (property.type !== 'Property') {\n continue;\n }\n\n if (property.key.type !== 'Identifier') {\n continue;\n }\n\n const className = property.key.name;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node: property,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n }\n },\n };\n },\n};\n","/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description:\n 'enforce importing node standard library modules using `node:` prefix',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebno-legacy-node-import',\n },\n schema: [],\n messages: {\n invalidImport:\n 'Node standard library modules must be imported using the \"node:\" prefix (e.g. \"node:{{moduleName}}\")',\n },\n },\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !NODE_STANDARD_MODULES.includes(node.source.value)\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidImport',\n data: { moduleName: node.source.value },\n fix(fixer) {\n if (typeof node.source.value !== 'string') {\n return null;\n }\n\n const newImportPath = `node:${node.source.value}`;\n const quote = node.source.raw[0]; // preserve original quote style\n\n return fixer.replaceText(\n node.source,\n `${quote}${newImportPath}${quote}`,\n );\n },\n });\n },\n };\n },\n};\n\nexport const NODE_STANDARD_MODULES = Object.freeze([\n 'assert',\n 'assert/strict',\n 'async_hooks',\n 'buffer',\n 'child_process',\n 'cluster',\n 'console',\n 'crypto',\n 'dns',\n 'dns/promises',\n 'domain',\n 'events',\n 'fs',\n 'fs/promises',\n 'http',\n 'http2',\n 'https',\n 'inspector',\n 'module',\n 'net',\n 'os',\n 'path',\n 'perf_hooks',\n 'process',\n 'punycode',\n 'querystring',\n 'readline',\n 'readline/promises',\n 'repl',\n 'sqlite',\n 'stream',\n 'stream/promises',\n 'string_decoder',\n 'test',\n 'timers',\n 'timers/promises',\n 'tls',\n 'trace_events',\n 'tty',\n 'url',\n 'util',\n 'util/types',\n 'v8',\n 'vm',\n 'wasi',\n 'worker_threads',\n 'zlib',\n]);\n","import path from 'node:path';\n\n/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce server actions are exported from file paths that match \"app/**/_actions.ts\" or \"app/**/_actions/**/*.ts\"',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebvalid-server-actions-path',\n },\n schema: [],\n messages: {\n invalidPath:\n 'Server action files must be located in a directory named \"_actions\" or have the filename \"_actions.ts\"',\n },\n },\n create(context) {\n return {\n ExpressionStatement(node) {\n if (\n node.expression.type !== 'Literal' ||\n node.expression.value !== 'use server'\n ) {\n return;\n }\n\n const basename = path.basename(context.filename);\n const dirname = path.dirname(context.filename);\n\n // Escape backslashes for RegExp (Windows paths)\n const escapedSep = path.sep.replace('\\\\', '\\\\\\\\');\n\n const isInActionsDir = new RegExp(\n `app(${escapedSep}.*)?${escapedSep}_actions`,\n ).test(dirname);\n\n const isActionsFile =\n (dirname === 'app' || new RegExp(`app${escapedSep}`).test(dirname)) &&\n /_actions\\.(js|ts)$/.test(basename);\n\n if (!isInActionsDir && !isActionsFile) {\n context.report({\n node,\n messageId: 'invalidPath',\n });\n }\n },\n };\n },\n};\n","import packageJson from '../package.json' with { type: 'json' };\n\nimport banLodashImport from './rules/ban-lodash-import.mjs';\nimport cssModuleNameMatchesRule from './rules/css-module-name-matches.mjs';\nimport cssModuleClassExistsRule from './rules/css-module-class-exists.mjs';\nimport noLegacyNodeImport from './rules/no-legacy-node-import.mjs';\nimport validServerActionsPathRule from './rules/valid-server-actions-path.mjs';\n\n/** @type {import('eslint').ESLint.Plugin} */\nconst plugin = {\n meta: {\n name: packageJson.name,\n version: packageJson.version,\n },\n configs: {},\n rules: {\n 'ban-lodash-import': banLodashImport,\n 'css-module-name-matches': cssModuleNameMatchesRule,\n 'css-module-class-exists': cssModuleClassExistsRule,\n 'no-legacy-node-import': noLegacyNodeImport,\n 'valid-server-actions-path': validServerActionsPathRule,\n },\n};\n\nconst RULE_NAMES = Object.keys(plugin.rules).map(\n (ruleName) => `friendsoftheweb/${ruleName}`,\n);\n\n/**\n * @param {'error' | 'warn'} reportLevel\n */\nfunction buildConfig(reportLevel) {\n return {\n plugins: {\n friendsoftheweb: plugin,\n },\n rules: Object.fromEntries(\n RULE_NAMES.map((ruleName) => [ruleName, reportLevel]),\n ),\n };\n}\n\nObject.assign(plugin.configs, {\n 'flat/recommended': [buildConfig('error')],\n 'flat/migrate': [buildConfig('warn')],\n recommended: buildConfig('error'),\n migrate: buildConfig('warn'),\n});\n\nexport default plugin;\n"],"names":["parse"],"mappings":";;;;;;;;;;;;;AAAA;AACA,sBAAe;AACb,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,IAAI,EAAE;AACJ,YAAA,WAAW,EACT,kEAAkE;AACpE,YAAA,GAAG,EAAE,mFAAmF;AACzF,SAAA;AACD,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,QAAQ,EAAE;AACR,YAAA,aAAa,EACX,iEAAiE;AACpE,SAAA;AACF,KAAA;AACD,IAAA,MAAM,CAAC,OAAO,EAAA;QACZ,OAAO;AACL,YAAA,iBAAiB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;AAED;;AAEG;AACH,SAAS,WAAW,CAAC,WAAW,EAAA;IAC9B,OAAO;AACL,QAAA,OAAO,EAAE;AACP,YAAA,eAAe,EAAE,MAAM;AACxB,SAAA;QACD,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CACtD;KACF;AACH;AAEA,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;AAC5B,IAAA,kBAAkB,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAC1C,IAAA,cAAc,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACrC,IAAA,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC;AACjC,IAAA,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC;AAC7B,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/rules/ban-lodash-import.ts","../../../../src/rules/css-module-name-matches.ts","../../../../src/rules/css-module-class-exists.ts","../../../../src/rules/no-legacy-node-import.ts","../../../../src/rules/react-named-func-components.ts","../../../../src/rules/valid-server-actions-path.ts","../../../../src/index.ts"],"sourcesContent":["import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\n\nconst banLodashImportRule: RuleModule<'invalidImport'> = {\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description:\n 'enforce importing functions from `lodash-es` instead of `lodash`',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebban-lodash-import',\n },\n schema: [],\n messages: {\n invalidImport:\n 'Functions must be imported from \"lodash-es\" instead of \"lodash\"',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n (node.source.value !== 'lodash' &&\n !node.source.value.startsWith('lodash/'))\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidImport',\n fix(fixer) {\n if (typeof node.source.value !== 'string') {\n return null;\n }\n\n if (node.source.value === 'lodash/fp') {\n return null; // no automatic fix for fp imports\n }\n\n const newImportPath =\n node.source.value === 'lodash'\n ? 'lodash-es'\n : node.source.value.replace(/^lodash\\//, 'lodash-es/');\n\n const quote = node.source.raw[0]; // preserve original quote style\n\n return fixer.replaceText(\n node.source,\n `${quote}${newImportPath}${quote}`,\n );\n },\n });\n },\n };\n },\n};\n\nexport default banLodashImportRule;\n","import path from 'node:path';\n\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\n\nconst cssModuleNameMatchesRule: RuleModule<'filenameMismatch'> = {\n meta: {\n type: 'problem',\n docs: {\n description:\n \"enforce that a CSS module's filename matches the filename of the importing file\",\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-name-matches',\n },\n schema: [],\n messages: {\n filenameMismatch:\n 'CSS module filename \"{{cssModuleFilename}}\" does not match the current filename \"{{filename}}\"',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !node.source.value.endsWith('.module.css')\n ) {\n return;\n }\n\n const filename = path.basename(\n context.filename,\n path.extname(context.filename),\n );\n\n const cssModulePath = node.source.value;\n const cssModuleFilename = path.basename(cssModulePath, '.module.css');\n\n if (cssModuleFilename !== filename) {\n context.report({\n node,\n messageId: 'filenameMismatch',\n data: {\n cssModuleFilename,\n filename,\n },\n });\n }\n },\n };\n },\n};\n\nexport default cssModuleNameMatchesRule;\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\nimport { parse } from 'postcss';\nimport selectorParser from 'postcss-selector-parser';\n\nconst cssModuleClassExistsRule: RuleModule<\n | 'relativePath'\n | 'defaultImport'\n | 'onlyDefaultImport'\n | 'fileDoesNotExist'\n | 'classDoesNotExist'\n> = {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce that class names used from an imported CSS module exist in the module file',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-class-exists',\n },\n schema: [],\n messages: {\n relativePath:\n 'CSS module import \"{{importPath}}\" should be a relative path',\n defaultImport:\n 'CSS module import \"{{importPath}}\" should have a default import',\n onlyDefaultImport:\n 'CSS module import \"{{importPath}}\" should have only a default import',\n fileDoesNotExist:\n 'CSS module file \"{{absoluteImportPath}}\" does not exist',\n classDoesNotExist:\n 'Class `.{{className}}` does not exist in the CSS module imported as `{{objectName}}`',\n },\n },\n defaultOptions: [],\n create(context) {\n const classNames = {};\n\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !node.source.value.endsWith('.module.css')\n ) {\n return;\n }\n\n const importPath = node.source.value;\n\n if (!(importPath.startsWith('./') || importPath.startsWith('../'))) {\n context.report({\n node,\n messageId: 'relativePath',\n data: { importPath },\n });\n\n return;\n }\n\n if (node.specifiers.length === 0) {\n context.report({\n node,\n messageId: 'defaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n if (node.specifiers.length > 1) {\n context.report({\n node,\n messageId: 'onlyDefaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n const defaultImportSpecifier = node.specifiers.find(\n (specifier) => specifier.type === 'ImportDefaultSpecifier',\n );\n\n if (defaultImportSpecifier == null) {\n context.report({\n node,\n messageId: 'onlyDefaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n const dirname = path.dirname(context.physicalFilename);\n const absoluteImportPath = path.resolve(dirname, importPath);\n\n if (!fs.existsSync(absoluteImportPath)) {\n context.report({\n node,\n messageId: 'fileDoesNotExist',\n data: { absoluteImportPath },\n });\n\n return;\n }\n\n const importName = defaultImportSpecifier.local.name;\n\n classNames[importName] = new Set();\n\n const cssModuleContent = fs.readFileSync(absoluteImportPath, 'utf8');\n const root = parse(cssModuleContent);\n\n for (const node of root.nodes) {\n if (node.type === 'rule') {\n selectorParser(function transform(selectors) {\n selectors.walkClasses((classNode) => {\n classNames[importName].add(classNode.value);\n });\n }).processSync(node.selector);\n } else if (\n node.type === 'atrule' &&\n (node.name === 'media' ||\n node.name === 'container' ||\n node.name === 'layer')\n ) {\n for (const childNode of node.nodes) {\n if (childNode.type !== 'rule') {\n continue;\n }\n\n selectorParser(function transform(selectors) {\n selectors.walkClasses((classNode) => {\n classNames[importName].add(classNode.value);\n });\n }).processSync(childNode.selector);\n }\n }\n }\n },\n MemberExpression(node) {\n if (node.object.type !== 'Identifier') {\n return;\n }\n\n if (classNames[node.object.name] == null) {\n return;\n }\n\n const objectName = node.object.name;\n\n if (node.property.type === 'Identifier') {\n const className = node.property.name;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n\n return;\n }\n\n if (\n node.property.type === 'Literal' &&\n typeof node.property.value === 'string'\n ) {\n const className = node.property.value;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n }\n },\n VariableDeclarator(node) {\n if (node.id.type !== 'ObjectPattern') {\n return;\n }\n\n if (node.init?.type !== 'Identifier') {\n return;\n }\n\n const objectName = node.init.name;\n\n if (classNames[objectName] == null) {\n return;\n }\n\n for (const property of node.id.properties) {\n if (property.type !== 'Property') {\n continue;\n }\n\n if (property.key.type !== 'Identifier') {\n continue;\n }\n\n const className = property.key.name;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node: property,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n }\n },\n };\n },\n};\n\nexport default cssModuleClassExistsRule;\n","import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\n\nconst noLegacyNodeImportRule: RuleModule<'invalidImport'> = {\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description:\n 'enforce importing node standard library modules using `node:` prefix',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebno-legacy-node-import',\n },\n schema: [],\n messages: {\n invalidImport:\n 'Node standard library modules must be imported using the \"node:\" prefix',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !NODE_STANDARD_MODULES.includes(node.source.value)\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidImport',\n fix(fixer) {\n if (typeof node.source.value !== 'string') {\n return null;\n }\n\n const newImportPath = `node:${node.source.value}`;\n const quote = node.source.raw[0]; // preserve original quote style\n\n return fixer.replaceText(\n node.source,\n `${quote}${newImportPath}${quote}`,\n );\n },\n });\n },\n };\n },\n};\n\nexport default noLegacyNodeImportRule;\n\nexport const NODE_STANDARD_MODULES = Object.freeze([\n 'assert',\n 'assert/strict',\n 'async_hooks',\n 'buffer',\n 'child_process',\n 'cluster',\n 'console',\n 'crypto',\n 'dns',\n 'dns/promises',\n 'domain',\n 'events',\n 'fs',\n 'fs/promises',\n 'http',\n 'http2',\n 'https',\n 'inspector',\n 'module',\n 'net',\n 'os',\n 'path',\n 'perf_hooks',\n 'process',\n 'punycode',\n 'querystring',\n 'readline',\n 'readline/promises',\n 'repl',\n 'sqlite',\n 'stream',\n 'stream/promises',\n 'string_decoder',\n 'test',\n 'timers',\n 'timers/promises',\n 'tls',\n 'trace_events',\n 'tty',\n 'url',\n 'util',\n 'util/types',\n 'v8',\n 'vm',\n 'wasi',\n 'worker_threads',\n 'zlib',\n]);\n","import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\nimport type {\n ArrowFunctionExpression,\n FunctionDeclaration,\n VariableDeclarator,\n} from 'estree';\n\nconst reactNamedFuncComponentsRule: RuleModule<'invalidComponentDefinition'> = {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce use of named functions when defining React components',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebreact-named-func-components',\n },\n schema: [],\n messages: {\n invalidComponentDefinition:\n 'React components must be defined using named functions',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n VariableDeclarator(node) {\n if (!isReactComponent(node as VariableDeclarator)) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidComponentDefinition',\n });\n },\n };\n },\n};\n\nexport default reactNamedFuncComponentsRule;\n\nfunction isReactComponent(\n node: FunctionDeclaration | ArrowFunctionExpression | VariableDeclarator,\n) {\n if (node.type === 'VariableDeclarator') {\n if (node.init == null) {\n return false;\n }\n\n if (node.init.type !== 'ArrowFunctionExpression') {\n return false;\n }\n\n if (node.id.type !== 'Identifier' || !/^[A-Z]/.test(node.id.name)) {\n return false;\n }\n\n return isReactComponent(node.init);\n } else if (node.type === 'FunctionDeclaration') {\n if (node.id != null && !/^[A-Z]/.test(node.id.name)) {\n return false;\n }\n }\n\n if (node.body.type !== 'BlockStatement') {\n return false;\n }\n\n for (const statement of node.body.body) {\n if (\n statement.type === 'ReturnStatement' &&\n statement.argument != null &&\n // @ts-expect-error: ESTree types are missing JSXElement\n (statement.argument.type === 'JSXElement' ||\n (statement.argument.type === 'Literal' &&\n statement.argument.value === null))\n ) {\n return true;\n }\n }\n\n return false;\n}\n","import path from 'node:path';\n\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\n\nconst validServerActionsPathRule: RuleModule<'invalidPath'> = {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce server actions are exported from file paths that match \"app/**/_actions.ts\" or \"app/**/_actions/**/*.ts\"',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebvalid-server-actions-path',\n },\n schema: [],\n messages: {\n invalidPath:\n 'Server action files must be located in a directory named \"_actions\" or have the filename \"_actions.ts\"',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ExpressionStatement(node) {\n if (\n node.expression.type !== 'Literal' ||\n node.expression.value !== 'use server'\n ) {\n return;\n }\n\n const basename = path.basename(context.filename);\n const dirname = path.dirname(context.filename);\n\n // Escape backslashes for RegExp (Windows paths)\n const escapedSep = path.sep.replace('\\\\', '\\\\\\\\');\n\n const isInActionsDir = new RegExp(\n `app(${escapedSep}.*)?${escapedSep}_actions`,\n ).test(dirname);\n\n const isActionsFile =\n (dirname === 'app' || new RegExp(`app${escapedSep}`).test(dirname)) &&\n /_actions\\.(js|ts)$/.test(basename);\n\n if (!isInActionsDir && !isActionsFile) {\n context.report({\n node,\n messageId: 'invalidPath',\n });\n }\n },\n };\n },\n};\n\nexport default validServerActionsPathRule;\n","import packageJson from '../package.json' with { type: 'json' };\n\nimport banLodashImport from './rules/ban-lodash-import.ts';\nimport cssModuleNameMatchesRule from './rules/css-module-name-matches.ts';\nimport cssModuleClassExistsRule from './rules/css-module-class-exists.ts';\nimport noLegacyNodeImport from './rules/no-legacy-node-import.ts';\nimport reactNamedFuncComponents from './rules/react-named-func-components.ts';\nimport validServerActionsPathRule from './rules/valid-server-actions-path.ts';\n\nconst plugin = {\n meta: {\n name: packageJson.name,\n version: packageJson.version,\n },\n configs: {},\n rules: {\n 'ban-lodash-import': banLodashImport,\n 'css-module-name-matches': cssModuleNameMatchesRule,\n 'css-module-class-exists': cssModuleClassExistsRule,\n 'no-legacy-node-import': noLegacyNodeImport,\n 'react-named-func-components': reactNamedFuncComponents,\n 'valid-server-actions-path': validServerActionsPathRule,\n },\n};\n\nconst RULE_NAMES = Object.keys(plugin.rules).map(\n (ruleName) => `friendsoftheweb/${ruleName}`,\n);\n\n/**\n * @param {'error' | 'warn'} reportLevel\n */\nfunction buildConfig(reportLevel) {\n return {\n plugins: {\n friendsoftheweb: plugin,\n },\n rules: Object.fromEntries(\n RULE_NAMES.map((ruleName) => [ruleName, reportLevel]),\n ),\n };\n}\n\nconst errorConfig = buildConfig('error');\nconst warnConfig = buildConfig('warn');\n\nconst futureConfig = {\n ...errorConfig,\n rules: {\n ...errorConfig.rules,\n 'friendsoftheweb/react-named-func-components': 'warn',\n },\n};\n\nconst recommendedConfig = {\n ...errorConfig,\n rules: {\n ...errorConfig.rules,\n 'friendsoftheweb/react-named-func-components': 'off',\n },\n};\n\nconst migrateConfig = {\n ...warnConfig,\n rules: {\n ...warnConfig.rules,\n 'friendsoftheweb/react-named-func-components': 'off',\n },\n};\n\nObject.assign(plugin.configs, {\n 'flat/future': [futureConfig],\n 'flat/recommended': [recommendedConfig],\n 'flat/migrate': [migrateConfig],\n future: futureConfig,\n recommended: recommendedConfig,\n migrate: migrateConfig,\n});\n\nexport default plugin;\n"],"names":["parse","banLodashImport","noLegacyNodeImport","reactNamedFuncComponents"],"mappings":";;;;;;;;;;;;;AAEA,MAAM,mBAAmB,GAAgC;AACvD,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,IAAI,EAAE;AACJ,YAAA,WAAW,EACT,kEAAkE;AACpE,YAAA,GAAG,EAAE,mFAAmF;AACzF,SAAA;AACD,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,QAAQ,EAAE;AACR,YAAA,aAAa,EACX,iEAAiE;AACpE,SAAA;AACF,KAAA;AACD,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,MAAM,CAAC,OAAO,EAAA;QACZ,OAAO;AACL,YAAA,iBAAiB,CAAC,IAAI,EAAA;AACpB,gBAAA,IACE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ;AACrC,qBAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ;AAC7B,wBAAA,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAC3C;oBACA;gBACF;gBAEA,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;AACJ,oBAAA,SAAS,EAAE,eAAe;AAC1B,oBAAA,GAAG,CAAC,KAAK,EAAA;wBACP,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE;AACzC,4BAAA,OAAO,IAAI;wBACb;wBAEA,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,WAAW,EAAE;4BACrC,OAAO,IAAI,CAAC;wBACd;wBAEA,MAAM,aAAa,GACjB,IAAI,CAAC,MAAM,CAAC,K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,EAAE;IAC5B,aAAa,EAAE,CAAC,YAAY,CAAC;IAC7B,kBAAkB,EAAE,CAAC,iBAAiB,CAAC;IACvC,cAAc,EAAE,CAAC,aAAa,CAAC;AAC/B,IAAA,MAAM,EAAE,YAAY;AACpB,IAAA,WAAW,EAAE,iBAAiB;AAC9B,IAAA,OAAO,EAAE,aAAa;AACvB,CAAA,CAAC;;;;"}
package/dist/esm/index.js CHANGED
@@ -4,13 +4,12 @@ import { parse } from 'postcss';
4
4
  import selectorParser from 'postcss-selector-parser';
5
5
 
6
6
  var name = "@friendsoftheweb/eslint-plugin";
7
- var version = "0.0.3-beta.0";
7
+ var version = "0.0.3-beta.1";
8
8
  var packageJson = {
9
9
  name: name,
10
10
  version: version};
11
11
 
12
- /** @type {import('eslint').JSRuleDefinition} */
13
- var banLodashImport = {
12
+ const banLodashImportRule = {
14
13
  meta: {
15
14
  type: 'problem',
16
15
  fixable: 'code',
@@ -23,6 +22,7 @@ var banLodashImport = {
23
22
  invalidImport: 'Functions must be imported from "lodash-es" instead of "lodash"',
24
23
  },
25
24
  },
25
+ defaultOptions: [],
26
26
  create(context) {
27
27
  return {
28
28
  ImportDeclaration(node) {
@@ -53,8 +53,7 @@ var banLodashImport = {
53
53
  },
54
54
  };
55
55
 
56
- /** @type {import('eslint').JSRuleDefinition} */
57
- var cssModuleNameMatchesRule = {
56
+ const cssModuleNameMatchesRule = {
58
57
  meta: {
59
58
  type: 'problem',
60
59
  docs: {
@@ -66,6 +65,7 @@ var cssModuleNameMatchesRule = {
66
65
  filenameMismatch: 'CSS module filename "{{cssModuleFilename}}" does not match the current filename "{{filename}}"',
67
66
  },
68
67
  },
68
+ defaultOptions: [],
69
69
  create(context) {
70
70
  return {
71
71
  ImportDeclaration(node) {
@@ -91,8 +91,7 @@ var cssModuleNameMatchesRule = {
91
91
  },
92
92
  };
93
93
 
94
- /** @type {import('eslint').JSRuleDefinition} */
95
- var cssModuleClassExistsRule = {
94
+ const cssModuleClassExistsRule = {
96
95
  meta: {
97
96
  type: 'problem',
98
97
  docs: {
@@ -108,6 +107,7 @@ var cssModuleClassExistsRule = {
108
107
  classDoesNotExist: 'Class `.{{className}}` does not exist in the CSS module imported as `{{objectName}}`',
109
108
  },
110
109
  },
110
+ defaultOptions: [],
111
111
  create(context) {
112
112
  const classNames = {};
113
113
  return {
@@ -253,8 +253,7 @@ var cssModuleClassExistsRule = {
253
253
  },
254
254
  };
255
255
 
256
- /** @type {import('eslint').JSRuleDefinition} */
257
- var noLegacyNodeImport = {
256
+ const noLegacyNodeImportRule = {
258
257
  meta: {
259
258
  type: 'problem',
260
259
  fixable: 'code',
@@ -264,9 +263,10 @@ var noLegacyNodeImport = {
264
263
  },
265
264
  schema: [],
266
265
  messages: {
267
- invalidImport: 'Node standard library modules must be imported using the "node:" prefix (e.g. "node:{{moduleName}}")',
266
+ invalidImport: 'Node standard library modules must be imported using the "node:" prefix',
268
267
  },
269
268
  },
269
+ defaultOptions: [],
270
270
  create(context) {
271
271
  return {
272
272
  ImportDeclaration(node) {
@@ -277,7 +277,6 @@ var noLegacyNodeImport = {
277
277
  context.report({
278
278
  node,
279
279
  messageId: 'invalidImport',
280
- data: { moduleName: node.source.value },
281
280
  fix(fixer) {
282
281
  if (typeof node.source.value !== 'string') {
283
282
  return null;
@@ -341,8 +340,68 @@ const NODE_STANDARD_MODULES = Object.freeze([
341
340
  'zlib',
342
341
  ]);
343
342
 
344
- /** @type {import('eslint').JSRuleDefinition} */
345
- var validServerActionsPathRule = {
343
+ const reactNamedFuncComponentsRule = {
344
+ meta: {
345
+ type: 'problem',
346
+ docs: {
347
+ description: 'enforce use of named functions when defining React components',
348
+ url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebreact-named-func-components',
349
+ },
350
+ schema: [],
351
+ messages: {
352
+ invalidComponentDefinition: 'React components must be defined using named functions',
353
+ },
354
+ },
355
+ defaultOptions: [],
356
+ create(context) {
357
+ return {
358
+ VariableDeclarator(node) {
359
+ if (!isReactComponent(node)) {
360
+ return;
361
+ }
362
+ context.report({
363
+ node,
364
+ messageId: 'invalidComponentDefinition',
365
+ });
366
+ },
367
+ };
368
+ },
369
+ };
370
+ function isReactComponent(node) {
371
+ if (node.type === 'VariableDeclarator') {
372
+ if (node.init == null) {
373
+ return false;
374
+ }
375
+ if (node.init.type !== 'ArrowFunctionExpression') {
376
+ return false;
377
+ }
378
+ if (node.id.type !== 'Identifier' || !/^[A-Z]/.test(node.id.name)) {
379
+ return false;
380
+ }
381
+ return isReactComponent(node.init);
382
+ }
383
+ else if (node.type === 'FunctionDeclaration') {
384
+ if (node.id != null && !/^[A-Z]/.test(node.id.name)) {
385
+ return false;
386
+ }
387
+ }
388
+ if (node.body.type !== 'BlockStatement') {
389
+ return false;
390
+ }
391
+ for (const statement of node.body.body) {
392
+ if (statement.type === 'ReturnStatement' &&
393
+ statement.argument != null &&
394
+ // @ts-expect-error: ESTree types are missing JSXElement
395
+ (statement.argument.type === 'JSXElement' ||
396
+ (statement.argument.type === 'Literal' &&
397
+ statement.argument.value === null))) {
398
+ return true;
399
+ }
400
+ }
401
+ return false;
402
+ }
403
+
404
+ const validServerActionsPathRule = {
346
405
  meta: {
347
406
  type: 'problem',
348
407
  docs: {
@@ -354,6 +413,7 @@ var validServerActionsPathRule = {
354
413
  invalidPath: 'Server action files must be located in a directory named "_actions" or have the filename "_actions.ts"',
355
414
  },
356
415
  },
416
+ defaultOptions: [],
357
417
  create(context) {
358
418
  return {
359
419
  ExpressionStatement(node) {
@@ -379,7 +439,6 @@ var validServerActionsPathRule = {
379
439
  },
380
440
  };
381
441
 
382
- /** @type {import('eslint').ESLint.Plugin} */
383
442
  const plugin = {
384
443
  meta: {
385
444
  name: packageJson.name,
@@ -387,10 +446,11 @@ const plugin = {
387
446
  },
388
447
  configs: {},
389
448
  rules: {
390
- 'ban-lodash-import': banLodashImport,
449
+ 'ban-lodash-import': banLodashImportRule,
391
450
  'css-module-name-matches': cssModuleNameMatchesRule,
392
451
  'css-module-class-exists': cssModuleClassExistsRule,
393
- 'no-legacy-node-import': noLegacyNodeImport,
452
+ 'no-legacy-node-import': noLegacyNodeImportRule,
453
+ 'react-named-func-components': reactNamedFuncComponentsRule,
394
454
  'valid-server-actions-path': validServerActionsPathRule,
395
455
  },
396
456
  };
@@ -406,11 +466,18 @@ function buildConfig(reportLevel) {
406
466
  rules: Object.fromEntries(RULE_NAMES.map((ruleName) => [ruleName, reportLevel])),
407
467
  };
408
468
  }
469
+ const errorConfig = buildConfig('error');
470
+ const warnConfig = buildConfig('warn');
471
+ const futureConfig = Object.assign(Object.assign({}, errorConfig), { rules: Object.assign(Object.assign({}, errorConfig.rules), { 'friendsoftheweb/react-named-func-components': 'warn' }) });
472
+ const recommendedConfig = Object.assign(Object.assign({}, errorConfig), { rules: Object.assign(Object.assign({}, errorConfig.rules), { 'friendsoftheweb/react-named-func-components': 'off' }) });
473
+ const migrateConfig = Object.assign(Object.assign({}, warnConfig), { rules: Object.assign(Object.assign({}, warnConfig.rules), { 'friendsoftheweb/react-named-func-components': 'off' }) });
409
474
  Object.assign(plugin.configs, {
410
- 'flat/recommended': [buildConfig('error')],
411
- 'flat/migrate': [buildConfig('warn')],
412
- recommended: buildConfig('error'),
413
- migrate: buildConfig('warn'),
475
+ 'flat/future': [futureConfig],
476
+ 'flat/recommended': [recommendedConfig],
477
+ 'flat/migrate': [migrateConfig],
478
+ future: futureConfig,
479
+ recommended: recommendedConfig,
480
+ migrate: migrateConfig,
414
481
  });
415
482
 
416
483
  export { plugin as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/rules/ban-lodash-import.mjs","../../../../src/rules/css-module-name-matches.mjs","../../../../src/rules/css-module-class-exists.mjs","../../../../src/rules/no-legacy-node-import.mjs","../../../../src/rules/valid-server-actions-path.mjs","../../../../src/index.mjs"],"sourcesContent":["/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description:\n 'enforce importing functions from `lodash-es` instead of `lodash`',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebban-lodash-import',\n },\n schema: [],\n messages: {\n invalidImport:\n 'Functions must be imported from \"lodash-es\" instead of \"lodash\"',\n },\n },\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n (node.source.value !== 'lodash' &&\n !node.source.value.startsWith('lodash/'))\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidImport',\n fix(fixer) {\n if (typeof node.source.value !== 'string') {\n return null;\n }\n\n if (node.source.value === 'lodash/fp') {\n return null; // no automatic fix for fp imports\n }\n\n const newImportPath =\n node.source.value === 'lodash'\n ? 'lodash-es'\n : node.source.value.replace(/^lodash\\//, 'lodash-es/');\n\n const quote = node.source.raw[0]; // preserve original quote style\n\n return fixer.replaceText(\n node.source,\n `${quote}${newImportPath}${quote}`,\n );\n },\n });\n },\n };\n },\n};\n","import path from 'node:path';\n\n/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n docs: {\n description:\n \"enforce that a CSS module's filename matches the filename of the importing file\",\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-name-matches',\n },\n schema: [],\n messages: {\n filenameMismatch:\n 'CSS module filename \"{{cssModuleFilename}}\" does not match the current filename \"{{filename}}\"',\n },\n },\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !node.source.value.endsWith('.module.css')\n ) {\n return;\n }\n\n const filename = path.basename(\n context.filename,\n path.extname(context.filename),\n );\n\n const cssModulePath = node.source.value;\n const cssModuleFilename = path.basename(cssModulePath, '.module.css');\n\n if (cssModuleFilename !== filename) {\n context.report({\n node,\n messageId: 'filenameMismatch',\n data: {\n cssModuleFilename,\n filename,\n },\n });\n }\n },\n };\n },\n};\n","import path from 'node:path';\nimport fs from 'node:fs';\n\nimport { parse } from 'postcss';\nimport selectorParser from 'postcss-selector-parser';\n\n/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce that class names used from an imported CSS module exist in the module file',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-class-exists',\n },\n schema: [],\n messages: {\n relativePath:\n 'CSS module import \"{{importPath}}\" should be a relative path',\n defaultImport:\n 'CSS module import \"{{importPath}}\" should have a default import',\n onlyDefaultImport:\n 'CSS module import \"{{importPath}}\" should have only a default import',\n fileDoesNotExist:\n 'CSS module file \"{{absoluteImportPath}}\" does not exist',\n classDoesNotExist:\n 'Class `.{{className}}` does not exist in the CSS module imported as `{{objectName}}`',\n },\n },\n create(context) {\n const classNames = {};\n\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !node.source.value.endsWith('.module.css')\n ) {\n return;\n }\n\n const importPath = node.source.value;\n\n if (!(importPath.startsWith('./') || importPath.startsWith('../'))) {\n context.report({\n node,\n messageId: 'relativePath',\n data: { importPath },\n });\n\n return;\n }\n\n if (node.specifiers.length === 0) {\n context.report({\n node,\n messageId: 'defaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n if (node.specifiers.length > 1) {\n context.report({\n node,\n messageId: 'onlyDefaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n const defaultImportSpecifier = node.specifiers.find(\n (specifier) => specifier.type === 'ImportDefaultSpecifier',\n );\n\n if (defaultImportSpecifier == null) {\n context.report({\n node,\n messageId: 'onlyDefaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n const dirname = path.dirname(context.physicalFilename);\n const absoluteImportPath = path.resolve(dirname, importPath);\n\n if (!fs.existsSync(absoluteImportPath)) {\n context.report({\n node,\n messageId: 'fileDoesNotExist',\n data: { absoluteImportPath },\n });\n\n return;\n }\n\n const importName = defaultImportSpecifier.local.name;\n\n classNames[importName] = new Set();\n\n const cssModuleContent = fs.readFileSync(absoluteImportPath, 'utf8');\n const root = parse(cssModuleContent);\n\n for (const node of root.nodes) {\n if (node.type === 'rule') {\n selectorParser(function transform(selectors) {\n selectors.walkClasses((classNode) => {\n classNames[importName].add(classNode.value);\n });\n }).processSync(node.selector);\n } else if (\n node.type === 'atrule' &&\n (node.name === 'media' ||\n node.name === 'container' ||\n node.name === 'layer')\n ) {\n for (const childNode of node.nodes) {\n if (childNode.type !== 'rule') {\n continue;\n }\n\n selectorParser(function transform(selectors) {\n selectors.walkClasses((classNode) => {\n classNames[importName].add(classNode.value);\n });\n }).processSync(childNode.selector);\n }\n }\n }\n },\n MemberExpression(node) {\n if (node.object.type !== 'Identifier') {\n return;\n }\n\n if (classNames[node.object.name] == null) {\n return;\n }\n\n const objectName = node.object.name;\n\n if (node.property.type === 'Identifier') {\n const className = node.property.name;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n\n return;\n }\n\n if (\n node.property.type === 'Literal' &&\n typeof node.property.value === 'string'\n ) {\n const className = node.property.value;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n }\n },\n VariableDeclarator(node) {\n if (node.id.type !== 'ObjectPattern') {\n return;\n }\n\n if (node.init?.type !== 'Identifier') {\n return;\n }\n\n const objectName = node.init.name;\n\n if (classNames[objectName] == null) {\n return;\n }\n\n for (const property of node.id.properties) {\n if (property.type !== 'Property') {\n continue;\n }\n\n if (property.key.type !== 'Identifier') {\n continue;\n }\n\n const className = property.key.name;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node: property,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n }\n },\n };\n },\n};\n","/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description:\n 'enforce importing node standard library modules using `node:` prefix',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebno-legacy-node-import',\n },\n schema: [],\n messages: {\n invalidImport:\n 'Node standard library modules must be imported using the \"node:\" prefix (e.g. \"node:{{moduleName}}\")',\n },\n },\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !NODE_STANDARD_MODULES.includes(node.source.value)\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidImport',\n data: { moduleName: node.source.value },\n fix(fixer) {\n if (typeof node.source.value !== 'string') {\n return null;\n }\n\n const newImportPath = `node:${node.source.value}`;\n const quote = node.source.raw[0]; // preserve original quote style\n\n return fixer.replaceText(\n node.source,\n `${quote}${newImportPath}${quote}`,\n );\n },\n });\n },\n };\n },\n};\n\nexport const NODE_STANDARD_MODULES = Object.freeze([\n 'assert',\n 'assert/strict',\n 'async_hooks',\n 'buffer',\n 'child_process',\n 'cluster',\n 'console',\n 'crypto',\n 'dns',\n 'dns/promises',\n 'domain',\n 'events',\n 'fs',\n 'fs/promises',\n 'http',\n 'http2',\n 'https',\n 'inspector',\n 'module',\n 'net',\n 'os',\n 'path',\n 'perf_hooks',\n 'process',\n 'punycode',\n 'querystring',\n 'readline',\n 'readline/promises',\n 'repl',\n 'sqlite',\n 'stream',\n 'stream/promises',\n 'string_decoder',\n 'test',\n 'timers',\n 'timers/promises',\n 'tls',\n 'trace_events',\n 'tty',\n 'url',\n 'util',\n 'util/types',\n 'v8',\n 'vm',\n 'wasi',\n 'worker_threads',\n 'zlib',\n]);\n","import path from 'node:path';\n\n/** @type {import('eslint').JSRuleDefinition} */\nexport default {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce server actions are exported from file paths that match \"app/**/_actions.ts\" or \"app/**/_actions/**/*.ts\"',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebvalid-server-actions-path',\n },\n schema: [],\n messages: {\n invalidPath:\n 'Server action files must be located in a directory named \"_actions\" or have the filename \"_actions.ts\"',\n },\n },\n create(context) {\n return {\n ExpressionStatement(node) {\n if (\n node.expression.type !== 'Literal' ||\n node.expression.value !== 'use server'\n ) {\n return;\n }\n\n const basename = path.basename(context.filename);\n const dirname = path.dirname(context.filename);\n\n // Escape backslashes for RegExp (Windows paths)\n const escapedSep = path.sep.replace('\\\\', '\\\\\\\\');\n\n const isInActionsDir = new RegExp(\n `app(${escapedSep}.*)?${escapedSep}_actions`,\n ).test(dirname);\n\n const isActionsFile =\n (dirname === 'app' || new RegExp(`app${escapedSep}`).test(dirname)) &&\n /_actions\\.(js|ts)$/.test(basename);\n\n if (!isInActionsDir && !isActionsFile) {\n context.report({\n node,\n messageId: 'invalidPath',\n });\n }\n },\n };\n },\n};\n","import packageJson from '../package.json' with { type: 'json' };\n\nimport banLodashImport from './rules/ban-lodash-import.mjs';\nimport cssModuleNameMatchesRule from './rules/css-module-name-matches.mjs';\nimport cssModuleClassExistsRule from './rules/css-module-class-exists.mjs';\nimport noLegacyNodeImport from './rules/no-legacy-node-import.mjs';\nimport validServerActionsPathRule from './rules/valid-server-actions-path.mjs';\n\n/** @type {import('eslint').ESLint.Plugin} */\nconst plugin = {\n meta: {\n name: packageJson.name,\n version: packageJson.version,\n },\n configs: {},\n rules: {\n 'ban-lodash-import': banLodashImport,\n 'css-module-name-matches': cssModuleNameMatchesRule,\n 'css-module-class-exists': cssModuleClassExistsRule,\n 'no-legacy-node-import': noLegacyNodeImport,\n 'valid-server-actions-path': validServerActionsPathRule,\n },\n};\n\nconst RULE_NAMES = Object.keys(plugin.rules).map(\n (ruleName) => `friendsoftheweb/${ruleName}`,\n);\n\n/**\n * @param {'error' | 'warn'} reportLevel\n */\nfunction buildConfig(reportLevel) {\n return {\n plugins: {\n friendsoftheweb: plugin,\n },\n rules: Object.fromEntries(\n RULE_NAMES.map((ruleName) => [ruleName, reportLevel]),\n ),\n };\n}\n\nObject.assign(plugin.configs, {\n 'flat/recommended': [buildConfig('error')],\n 'flat/migrate': [buildConfig('warn')],\n recommended: buildConfig('error'),\n migrate: buildConfig('warn'),\n});\n\nexport default plugin;\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;AACA,sBAAe;AACb,IAAA,IAAI,EAAE;AAC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B,EAAE,eAAe;AACpC,QAAA,yBAAyB,EAAE,wBAAwB;AACnD,QAAA,yBAAyB,EAAE,wBAAwB;AACnD,QAAA,uBAAuB,EAAE,kBAAkB;AAC3C,QAAA,2BAA2B,EAAE,0BAA0B;AACxD,KAAA;;AAGH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAC9C,CAAC,QAAQ,KAAK,CAAA,gBAAA,EAAmB,QAAQ,CAAA,CAAE,CAC5C;AAED;;AAEG;AACH,SAAS,WAAW,CAAC,WAAW,EAAA;IAC9B,OAAO;AACL,QAAA,OAAO,EAAE;AACP,YAAA,eAAe,EAAE,MAAM;AACxB,SAAA;QACD,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CACtD;KACF;AACH;AAEA,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;AAC5B,IAAA,kBAAkB,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAC1C,IAAA,cAAc,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACrC,IAAA,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC;AACjC,IAAA,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC;AAC7B,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/rules/ban-lodash-import.ts","../../../../src/rules/css-module-name-matches.ts","../../../../src/rules/css-module-class-exists.ts","../../../../src/rules/no-legacy-node-import.ts","../../../../src/rules/react-named-func-components.ts","../../../../src/rules/valid-server-actions-path.ts","../../../../src/index.ts"],"sourcesContent":["import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\n\nconst banLodashImportRule: RuleModule<'invalidImport'> = {\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description:\n 'enforce importing functions from `lodash-es` instead of `lodash`',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebban-lodash-import',\n },\n schema: [],\n messages: {\n invalidImport:\n 'Functions must be imported from \"lodash-es\" instead of \"lodash\"',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n (node.source.value !== 'lodash' &&\n !node.source.value.startsWith('lodash/'))\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidImport',\n fix(fixer) {\n if (typeof node.source.value !== 'string') {\n return null;\n }\n\n if (node.source.value === 'lodash/fp') {\n return null; // no automatic fix for fp imports\n }\n\n const newImportPath =\n node.source.value === 'lodash'\n ? 'lodash-es'\n : node.source.value.replace(/^lodash\\//, 'lodash-es/');\n\n const quote = node.source.raw[0]; // preserve original quote style\n\n return fixer.replaceText(\n node.source,\n `${quote}${newImportPath}${quote}`,\n );\n },\n });\n },\n };\n },\n};\n\nexport default banLodashImportRule;\n","import path from 'node:path';\n\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\n\nconst cssModuleNameMatchesRule: RuleModule<'filenameMismatch'> = {\n meta: {\n type: 'problem',\n docs: {\n description:\n \"enforce that a CSS module's filename matches the filename of the importing file\",\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-name-matches',\n },\n schema: [],\n messages: {\n filenameMismatch:\n 'CSS module filename \"{{cssModuleFilename}}\" does not match the current filename \"{{filename}}\"',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !node.source.value.endsWith('.module.css')\n ) {\n return;\n }\n\n const filename = path.basename(\n context.filename,\n path.extname(context.filename),\n );\n\n const cssModulePath = node.source.value;\n const cssModuleFilename = path.basename(cssModulePath, '.module.css');\n\n if (cssModuleFilename !== filename) {\n context.report({\n node,\n messageId: 'filenameMismatch',\n data: {\n cssModuleFilename,\n filename,\n },\n });\n }\n },\n };\n },\n};\n\nexport default cssModuleNameMatchesRule;\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\nimport { parse } from 'postcss';\nimport selectorParser from 'postcss-selector-parser';\n\nconst cssModuleClassExistsRule: RuleModule<\n | 'relativePath'\n | 'defaultImport'\n | 'onlyDefaultImport'\n | 'fileDoesNotExist'\n | 'classDoesNotExist'\n> = {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce that class names used from an imported CSS module exist in the module file',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-class-exists',\n },\n schema: [],\n messages: {\n relativePath:\n 'CSS module import \"{{importPath}}\" should be a relative path',\n defaultImport:\n 'CSS module import \"{{importPath}}\" should have a default import',\n onlyDefaultImport:\n 'CSS module import \"{{importPath}}\" should have only a default import',\n fileDoesNotExist:\n 'CSS module file \"{{absoluteImportPath}}\" does not exist',\n classDoesNotExist:\n 'Class `.{{className}}` does not exist in the CSS module imported as `{{objectName}}`',\n },\n },\n defaultOptions: [],\n create(context) {\n const classNames = {};\n\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !node.source.value.endsWith('.module.css')\n ) {\n return;\n }\n\n const importPath = node.source.value;\n\n if (!(importPath.startsWith('./') || importPath.startsWith('../'))) {\n context.report({\n node,\n messageId: 'relativePath',\n data: { importPath },\n });\n\n return;\n }\n\n if (node.specifiers.length === 0) {\n context.report({\n node,\n messageId: 'defaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n if (node.specifiers.length > 1) {\n context.report({\n node,\n messageId: 'onlyDefaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n const defaultImportSpecifier = node.specifiers.find(\n (specifier) => specifier.type === 'ImportDefaultSpecifier',\n );\n\n if (defaultImportSpecifier == null) {\n context.report({\n node,\n messageId: 'onlyDefaultImport',\n data: { importPath },\n });\n\n return;\n }\n\n const dirname = path.dirname(context.physicalFilename);\n const absoluteImportPath = path.resolve(dirname, importPath);\n\n if (!fs.existsSync(absoluteImportPath)) {\n context.report({\n node,\n messageId: 'fileDoesNotExist',\n data: { absoluteImportPath },\n });\n\n return;\n }\n\n const importName = defaultImportSpecifier.local.name;\n\n classNames[importName] = new Set();\n\n const cssModuleContent = fs.readFileSync(absoluteImportPath, 'utf8');\n const root = parse(cssModuleContent);\n\n for (const node of root.nodes) {\n if (node.type === 'rule') {\n selectorParser(function transform(selectors) {\n selectors.walkClasses((classNode) => {\n classNames[importName].add(classNode.value);\n });\n }).processSync(node.selector);\n } else if (\n node.type === 'atrule' &&\n (node.name === 'media' ||\n node.name === 'container' ||\n node.name === 'layer')\n ) {\n for (const childNode of node.nodes) {\n if (childNode.type !== 'rule') {\n continue;\n }\n\n selectorParser(function transform(selectors) {\n selectors.walkClasses((classNode) => {\n classNames[importName].add(classNode.value);\n });\n }).processSync(childNode.selector);\n }\n }\n }\n },\n MemberExpression(node) {\n if (node.object.type !== 'Identifier') {\n return;\n }\n\n if (classNames[node.object.name] == null) {\n return;\n }\n\n const objectName = node.object.name;\n\n if (node.property.type === 'Identifier') {\n const className = node.property.name;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n\n return;\n }\n\n if (\n node.property.type === 'Literal' &&\n typeof node.property.value === 'string'\n ) {\n const className = node.property.value;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n }\n },\n VariableDeclarator(node) {\n if (node.id.type !== 'ObjectPattern') {\n return;\n }\n\n if (node.init?.type !== 'Identifier') {\n return;\n }\n\n const objectName = node.init.name;\n\n if (classNames[objectName] == null) {\n return;\n }\n\n for (const property of node.id.properties) {\n if (property.type !== 'Property') {\n continue;\n }\n\n if (property.key.type !== 'Identifier') {\n continue;\n }\n\n const className = property.key.name;\n\n if (!classNames[objectName].has(className)) {\n context.report({\n node: property,\n messageId: 'classDoesNotExist',\n data: { className, objectName },\n });\n }\n }\n },\n };\n },\n};\n\nexport default cssModuleClassExistsRule;\n","import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\n\nconst noLegacyNodeImportRule: RuleModule<'invalidImport'> = {\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description:\n 'enforce importing node standard library modules using `node:` prefix',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebno-legacy-node-import',\n },\n schema: [],\n messages: {\n invalidImport:\n 'Node standard library modules must be imported using the \"node:\" prefix',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ImportDeclaration(node) {\n if (\n typeof node.source.value !== 'string' ||\n !NODE_STANDARD_MODULES.includes(node.source.value)\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidImport',\n fix(fixer) {\n if (typeof node.source.value !== 'string') {\n return null;\n }\n\n const newImportPath = `node:${node.source.value}`;\n const quote = node.source.raw[0]; // preserve original quote style\n\n return fixer.replaceText(\n node.source,\n `${quote}${newImportPath}${quote}`,\n );\n },\n });\n },\n };\n },\n};\n\nexport default noLegacyNodeImportRule;\n\nexport const NODE_STANDARD_MODULES = Object.freeze([\n 'assert',\n 'assert/strict',\n 'async_hooks',\n 'buffer',\n 'child_process',\n 'cluster',\n 'console',\n 'crypto',\n 'dns',\n 'dns/promises',\n 'domain',\n 'events',\n 'fs',\n 'fs/promises',\n 'http',\n 'http2',\n 'https',\n 'inspector',\n 'module',\n 'net',\n 'os',\n 'path',\n 'perf_hooks',\n 'process',\n 'punycode',\n 'querystring',\n 'readline',\n 'readline/promises',\n 'repl',\n 'sqlite',\n 'stream',\n 'stream/promises',\n 'string_decoder',\n 'test',\n 'timers',\n 'timers/promises',\n 'tls',\n 'trace_events',\n 'tty',\n 'url',\n 'util',\n 'util/types',\n 'v8',\n 'vm',\n 'wasi',\n 'worker_threads',\n 'zlib',\n]);\n","import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\nimport type {\n ArrowFunctionExpression,\n FunctionDeclaration,\n VariableDeclarator,\n} from 'estree';\n\nconst reactNamedFuncComponentsRule: RuleModule<'invalidComponentDefinition'> = {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce use of named functions when defining React components',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebreact-named-func-components',\n },\n schema: [],\n messages: {\n invalidComponentDefinition:\n 'React components must be defined using named functions',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n VariableDeclarator(node) {\n if (!isReactComponent(node as VariableDeclarator)) {\n return;\n }\n\n context.report({\n node,\n messageId: 'invalidComponentDefinition',\n });\n },\n };\n },\n};\n\nexport default reactNamedFuncComponentsRule;\n\nfunction isReactComponent(\n node: FunctionDeclaration | ArrowFunctionExpression | VariableDeclarator,\n) {\n if (node.type === 'VariableDeclarator') {\n if (node.init == null) {\n return false;\n }\n\n if (node.init.type !== 'ArrowFunctionExpression') {\n return false;\n }\n\n if (node.id.type !== 'Identifier' || !/^[A-Z]/.test(node.id.name)) {\n return false;\n }\n\n return isReactComponent(node.init);\n } else if (node.type === 'FunctionDeclaration') {\n if (node.id != null && !/^[A-Z]/.test(node.id.name)) {\n return false;\n }\n }\n\n if (node.body.type !== 'BlockStatement') {\n return false;\n }\n\n for (const statement of node.body.body) {\n if (\n statement.type === 'ReturnStatement' &&\n statement.argument != null &&\n // @ts-expect-error: ESTree types are missing JSXElement\n (statement.argument.type === 'JSXElement' ||\n (statement.argument.type === 'Literal' &&\n statement.argument.value === null))\n ) {\n return true;\n }\n }\n\n return false;\n}\n","import path from 'node:path';\n\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint';\n\nconst validServerActionsPathRule: RuleModule<'invalidPath'> = {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'enforce server actions are exported from file paths that match \"app/**/_actions.ts\" or \"app/**/_actions/**/*.ts\"',\n url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebvalid-server-actions-path',\n },\n schema: [],\n messages: {\n invalidPath:\n 'Server action files must be located in a directory named \"_actions\" or have the filename \"_actions.ts\"',\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ExpressionStatement(node) {\n if (\n node.expression.type !== 'Literal' ||\n node.expression.value !== 'use server'\n ) {\n return;\n }\n\n const basename = path.basename(context.filename);\n const dirname = path.dirname(context.filename);\n\n // Escape backslashes for RegExp (Windows paths)\n const escapedSep = path.sep.replace('\\\\', '\\\\\\\\');\n\n const isInActionsDir = new RegExp(\n `app(${escapedSep}.*)?${escapedSep}_actions`,\n ).test(dirname);\n\n const isActionsFile =\n (dirname === 'app' || new RegExp(`app${escapedSep}`).test(dirname)) &&\n /_actions\\.(js|ts)$/.test(basename);\n\n if (!isInActionsDir && !isActionsFile) {\n context.report({\n node,\n messageId: 'invalidPath',\n });\n }\n },\n };\n },\n};\n\nexport default validServerActionsPathRule;\n","import packageJson from '../package.json' with { type: 'json' };\n\nimport banLodashImport from './rules/ban-lodash-import.ts';\nimport cssModuleNameMatchesRule from './rules/css-module-name-matches.ts';\nimport cssModuleClassExistsRule from './rules/css-module-class-exists.ts';\nimport noLegacyNodeImport from './rules/no-legacy-node-import.ts';\nimport reactNamedFuncComponents from './rules/react-named-func-components.ts';\nimport validServerActionsPathRule from './rules/valid-server-actions-path.ts';\n\nconst plugin = {\n meta: {\n name: packageJson.name,\n version: packageJson.version,\n },\n configs: {},\n rules: {\n 'ban-lodash-import': banLodashImport,\n 'css-module-name-matches': cssModuleNameMatchesRule,\n 'css-module-class-exists': cssModuleClassExistsRule,\n 'no-legacy-node-import': noLegacyNodeImport,\n 'react-named-func-components': reactNamedFuncComponents,\n 'valid-server-actions-path': validServerActionsPathRule,\n },\n};\n\nconst RULE_NAMES = Object.keys(plugin.rules).map(\n (ruleName) => `friendsoftheweb/${ruleName}`,\n);\n\n/**\n * @param {'error' | 'warn'} reportLevel\n */\nfunction buildConfig(reportLevel) {\n return {\n plugins: {\n friendsoftheweb: plugin,\n },\n rules: Object.fromEntries(\n RULE_NAMES.map((ruleName) => [ruleName, reportLevel]),\n ),\n };\n}\n\nconst errorConfig = buildConfig('error');\nconst warnConfig = buildConfig('warn');\n\nconst futureConfig = {\n ...errorConfig,\n rules: {\n ...errorConfig.rules,\n 'friendsoftheweb/react-named-func-components': 'warn',\n },\n};\n\nconst recommendedConfig = {\n ...errorConfig,\n rules: {\n ...errorConfig.rules,\n 'friendsoftheweb/react-named-func-components': 'off',\n },\n};\n\nconst migrateConfig = {\n ...warnConfig,\n rules: {\n ...warnConfig.rules,\n 'friendsoftheweb/react-named-func-components': 'off',\n },\n};\n\nObject.assign(plugin.configs, {\n 'flat/future': [futureConfig],\n 'flat/recommended': [recommendedConfig],\n 'flat/migrate': [migrateConfig],\n future: futureConfig,\n recommended: recommendedConfig,\n migrate: migrateConfig,\n});\n\nexport default plugin;\n"],"names":["banLodashImport","noLegacyNodeImport","reactNamedFuncComponents"],"mappings":";;;;;;;;;;;AAEA,MAAM,mBAAmB,GAAgC;AACvD,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,IAAI,EAAE;AACJ,YAAA,WAAW,EACT,kEAAkE;AACpE,YAAA,GAAG,EAAE,mFAAmF;AACzF,SAAA;AACD,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,QAAQ,EAAE;AACR,YAAA,aAAa,EACX,iEAAiE;AACpE,SAAA;AACF,KAAA;AACD,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,MAAM,CAAC,OAAO,EAAA;QACZ,OAAO;AACL,YAAA,iBAAiB,CAAC,IAAI,EAAA;AACpB,gBAAA,IACE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ;AACrC,qBAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ;AAC7B,wBAAA,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAC3C;oBACA;gBACF;gBAEA,OAAO,CAAC,MAAM,CAAC;oBACb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ACpB,6CAA6C,EAAE,KAAK,MAEvD;AAED,MAAM,aAAa,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACd,UAAU,CAAA,EAAA,EACb,KAAK,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACA,UAAU,CAAC,KAAK,CAAA,EAAA,EACnB,6CAA6C,EAAE,KAAK,MAEvD;AAED,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;IAC5B,aAAa,EAAE,CAAC,YAAY,CAAC;IAC7B,kBAAkB,EAAE,CAAC,iBAAiB,CAAC;IACvC,cAAc,EAAE,CAAC,aAAa,CAAC;AAC/B,IAAA,MAAM,EAAE,YAAY;AACpB,IAAA,WAAW,EAAE,iBAAiB;AAC9B,IAAA,OAAO,EAAE,aAAa;AACvB,CAAA,CAAC;;;;"}
@@ -0,0 +1,16 @@
1
+ declare const plugin: {
2
+ meta: {
3
+ name: string;
4
+ version: string;
5
+ };
6
+ configs: {};
7
+ rules: {
8
+ 'ban-lodash-import': import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidImport", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
9
+ 'css-module-name-matches': import("@typescript-eslint/utils/ts-eslint").RuleModule<"filenameMismatch", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
10
+ 'css-module-class-exists': import("@typescript-eslint/utils/ts-eslint").RuleModule<"relativePath" | "defaultImport" | "onlyDefaultImport" | "fileDoesNotExist" | "classDoesNotExist", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
11
+ 'no-legacy-node-import': import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidImport", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
12
+ 'react-named-func-components': import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidComponentDefinition", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
13
+ 'valid-server-actions-path': import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidPath", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
14
+ };
15
+ };
16
+ export default plugin;
@@ -0,0 +1,3 @@
1
+ import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const banLodashImportRule: RuleModule<'invalidImport'>;
3
+ export default banLodashImportRule;
@@ -0,0 +1,3 @@
1
+ import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const cssModuleClassExistsRule: RuleModule<'relativePath' | 'defaultImport' | 'onlyDefaultImport' | 'fileDoesNotExist' | 'classDoesNotExist'>;
3
+ export default cssModuleClassExistsRule;
@@ -0,0 +1,3 @@
1
+ import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const cssModuleNameMatchesRule: RuleModule<'filenameMismatch'>;
3
+ export default cssModuleNameMatchesRule;
@@ -0,0 +1,4 @@
1
+ import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const noLegacyNodeImportRule: RuleModule<'invalidImport'>;
3
+ export default noLegacyNodeImportRule;
4
+ export declare const NODE_STANDARD_MODULES: readonly string[];
@@ -0,0 +1,3 @@
1
+ import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const reactNamedFuncComponentsRule: RuleModule<'invalidComponentDefinition'>;
3
+ export default reactNamedFuncComponentsRule;
@@ -0,0 +1,3 @@
1
+ import type { RuleModule } from '@typescript-eslint/utils/ts-eslint';
2
+ declare const validServerActionsPathRule: RuleModule<'invalidPath'>;
3
+ export default validServerActionsPathRule;
package/package.json CHANGED
@@ -3,7 +3,8 @@
3
3
  "repository": {
4
4
  "url": "git+https://github.com/friendsoftheweb/eslint-plugin.git"
5
5
  },
6
- "version": "0.0.3-beta.0",
6
+ "version": "0.0.3-beta.1",
7
+ "type": "module",
7
8
  "license": "MIT",
8
9
  "packageManager": "yarn@4.12.0",
9
10
  "main": "./dist/cjs/index.js",
@@ -21,7 +22,7 @@
21
22
  "dist"
22
23
  ],
23
24
  "scripts": {
24
- "test": "node test/index.mjs",
25
+ "test": "node --experimental-strip-types test/index.ts",
25
26
  "types:check": "tsc --noEmit",
26
27
  "lint": "eslint",
27
28
  "format:check": "prettier --check .",
@@ -32,6 +33,10 @@
32
33
  "@rollup/plugin-json": "^6.1.0",
33
34
  "@rollup/plugin-typescript": "^12.3.0",
34
35
  "@types/node": "^22.19.3",
36
+ "@types/sinon": "^21.0.0",
37
+ "@typescript-eslint/rule-tester": "^8.52.0",
38
+ "@typescript-eslint/types": "^8.52.0",
39
+ "@typescript-eslint/utils": "^8.52.0",
35
40
  "eslint": "^9.39.2",
36
41
  "eslint-plugin-eslint-plugin": "^7.3.0",
37
42
  "prettier": "^3.7.4",
@@ -1,3 +0,0 @@
1
- export default plugin;
2
- /** @type {import('eslint').ESLint.Plugin} */
3
- declare const plugin: import("eslint").ESLint.Plugin;
@@ -1,24 +0,0 @@
1
- declare const _default: {
2
- meta: {
3
- type: "problem";
4
- fixable: "code";
5
- docs: {
6
- description: string;
7
- url: string;
8
- };
9
- schema: any[];
10
- messages: {
11
- invalidImport: string;
12
- };
13
- };
14
- create(context: import("@eslint/core", { with: { "resolution-mode": "require" } }).RuleContext<{
15
- LangOptions: import("eslint").Linter.LanguageOptions;
16
- Code: import("eslint").SourceCode;
17
- RuleOptions: unknown[];
18
- Node: import("eslint").JSSyntaxElement;
19
- MessageIds: string;
20
- }>): {
21
- ImportDeclaration(node: import("estree").ImportDeclaration & import("eslint").Rule.NodeParentExtension): void;
22
- };
23
- };
24
- export default _default;
@@ -1,29 +0,0 @@
1
- declare const _default: {
2
- meta: {
3
- type: "problem";
4
- docs: {
5
- description: string;
6
- url: string;
7
- };
8
- schema: any[];
9
- messages: {
10
- relativePath: string;
11
- defaultImport: string;
12
- onlyDefaultImport: string;
13
- fileDoesNotExist: string;
14
- classDoesNotExist: string;
15
- };
16
- };
17
- create(context: import("@eslint/core", { with: { "resolution-mode": "require" } }).RuleContext<{
18
- LangOptions: import("eslint").Linter.LanguageOptions;
19
- Code: import("eslint").SourceCode;
20
- RuleOptions: unknown[];
21
- Node: import("eslint").JSSyntaxElement;
22
- MessageIds: string;
23
- }>): {
24
- ImportDeclaration(node: import("estree").ImportDeclaration & import("eslint").Rule.NodeParentExtension): void;
25
- MemberExpression(node: import("estree").MemberExpression & import("eslint").Rule.NodeParentExtension): void;
26
- VariableDeclarator(node: import("estree").VariableDeclarator & import("eslint").Rule.NodeParentExtension): void;
27
- };
28
- };
29
- export default _default;
@@ -1,23 +0,0 @@
1
- declare const _default: {
2
- meta: {
3
- type: "problem";
4
- docs: {
5
- description: string;
6
- url: string;
7
- };
8
- schema: any[];
9
- messages: {
10
- filenameMismatch: string;
11
- };
12
- };
13
- create(context: import("@eslint/core", { with: { "resolution-mode": "require" } }).RuleContext<{
14
- LangOptions: import("eslint").Linter.LanguageOptions;
15
- Code: import("eslint").SourceCode;
16
- RuleOptions: unknown[];
17
- Node: import("eslint").JSSyntaxElement;
18
- MessageIds: string;
19
- }>): {
20
- ImportDeclaration(node: import("estree").ImportDeclaration & import("eslint").Rule.NodeParentExtension): void;
21
- };
22
- };
23
- export default _default;
@@ -1,25 +0,0 @@
1
- declare const _default: {
2
- meta: {
3
- type: "problem";
4
- fixable: "code";
5
- docs: {
6
- description: string;
7
- url: string;
8
- };
9
- schema: any[];
10
- messages: {
11
- invalidImport: string;
12
- };
13
- };
14
- create(context: import("@eslint/core", { with: { "resolution-mode": "require" } }).RuleContext<{
15
- LangOptions: import("eslint").Linter.LanguageOptions;
16
- Code: import("eslint").SourceCode;
17
- RuleOptions: unknown[];
18
- Node: import("eslint").JSSyntaxElement;
19
- MessageIds: string;
20
- }>): {
21
- ImportDeclaration(node: import("estree").ImportDeclaration & import("eslint").Rule.NodeParentExtension): void;
22
- };
23
- };
24
- export default _default;
25
- export const NODE_STANDARD_MODULES: readonly string[];
@@ -1,23 +0,0 @@
1
- declare const _default: {
2
- meta: {
3
- type: "problem";
4
- docs: {
5
- description: string;
6
- url: string;
7
- };
8
- schema: any[];
9
- messages: {
10
- invalidPath: string;
11
- };
12
- };
13
- create(context: import("@eslint/core", { with: { "resolution-mode": "require" } }).RuleContext<{
14
- LangOptions: import("eslint").Linter.LanguageOptions;
15
- Code: import("eslint").SourceCode;
16
- RuleOptions: unknown[];
17
- Node: import("eslint").JSSyntaxElement;
18
- MessageIds: string;
19
- }>): {
20
- ExpressionStatement(node: import("estree").ExpressionStatement & import("eslint").Rule.NodeParentExtension): void;
21
- };
22
- };
23
- export default _default;