@friendsoftheweb/eslint-plugin 0.0.2-beta.0 → 0.0.3-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +110 -45
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +110 -45
- package/dist/esm/index.js.map +1 -1
- package/dist/types/rules/ban-lodash-import.d.mts +1 -0
- package/dist/types/rules/css-module-class-exists.d.mts +1 -0
- package/dist/types/rules/css-module-name-matches.d.mts +1 -0
- package/dist/types/rules/no-legacy-node-import.d.mts +25 -0
- package/dist/types/rules/valid-server-actions-path.d.mts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ 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.
|
|
9
|
+
var version = "0.0.3-beta.0";
|
|
10
10
|
var packageJson = {
|
|
11
11
|
name: name,
|
|
12
12
|
version: version};
|
|
@@ -18,6 +18,7 @@ var banLodashImport = {
|
|
|
18
18
|
fixable: 'code',
|
|
19
19
|
docs: {
|
|
20
20
|
description: 'enforce importing functions from `lodash-es` instead of `lodash`',
|
|
21
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebban-lodash-import',
|
|
21
22
|
},
|
|
22
23
|
schema: [],
|
|
23
24
|
messages: {
|
|
@@ -60,6 +61,7 @@ var cssModuleNameMatchesRule = {
|
|
|
60
61
|
type: 'problem',
|
|
61
62
|
docs: {
|
|
62
63
|
description: "enforce that a CSS module's filename matches the filename of the importing file",
|
|
64
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-name-matches',
|
|
63
65
|
},
|
|
64
66
|
schema: [],
|
|
65
67
|
messages: {
|
|
@@ -97,6 +99,7 @@ var cssModuleClassExistsRule = {
|
|
|
97
99
|
type: 'problem',
|
|
98
100
|
docs: {
|
|
99
101
|
description: 'enforce that class names used from an imported CSS module exist in the module file',
|
|
102
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-class-exists',
|
|
100
103
|
},
|
|
101
104
|
schema: [],
|
|
102
105
|
messages: {
|
|
@@ -252,12 +255,101 @@ var cssModuleClassExistsRule = {
|
|
|
252
255
|
},
|
|
253
256
|
};
|
|
254
257
|
|
|
258
|
+
/** @type {import('eslint').JSRuleDefinition} */
|
|
259
|
+
var noLegacyNodeImport = {
|
|
260
|
+
meta: {
|
|
261
|
+
type: 'problem',
|
|
262
|
+
fixable: 'code',
|
|
263
|
+
docs: {
|
|
264
|
+
description: 'enforce importing node standard library modules using `node:` prefix',
|
|
265
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebno-legacy-node-import',
|
|
266
|
+
},
|
|
267
|
+
schema: [],
|
|
268
|
+
messages: {
|
|
269
|
+
invalidImport: 'Node standard library modules must be imported using the "node:" prefix (e.g. "node:{{moduleName}}")',
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
create(context) {
|
|
273
|
+
return {
|
|
274
|
+
ImportDeclaration(node) {
|
|
275
|
+
if (typeof node.source.value !== 'string' ||
|
|
276
|
+
!NODE_STANDARD_MODULES.includes(node.source.value)) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
context.report({
|
|
280
|
+
node,
|
|
281
|
+
messageId: 'invalidImport',
|
|
282
|
+
data: { moduleName: node.source.value },
|
|
283
|
+
fix(fixer) {
|
|
284
|
+
if (typeof node.source.value !== 'string') {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
const newImportPath = `node:${node.source.value}`;
|
|
288
|
+
const quote = node.source.raw[0]; // preserve original quote style
|
|
289
|
+
return fixer.replaceText(node.source, `${quote}${newImportPath}${quote}`);
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
const NODE_STANDARD_MODULES = Object.freeze([
|
|
297
|
+
'assert',
|
|
298
|
+
'assert/strict',
|
|
299
|
+
'async_hooks',
|
|
300
|
+
'buffer',
|
|
301
|
+
'child_process',
|
|
302
|
+
'cluster',
|
|
303
|
+
'console',
|
|
304
|
+
'crypto',
|
|
305
|
+
'dns',
|
|
306
|
+
'dns/promises',
|
|
307
|
+
'domain',
|
|
308
|
+
'events',
|
|
309
|
+
'fs',
|
|
310
|
+
'fs/promises',
|
|
311
|
+
'http',
|
|
312
|
+
'http2',
|
|
313
|
+
'https',
|
|
314
|
+
'inspector',
|
|
315
|
+
'module',
|
|
316
|
+
'net',
|
|
317
|
+
'os',
|
|
318
|
+
'path',
|
|
319
|
+
'perf_hooks',
|
|
320
|
+
'process',
|
|
321
|
+
'punycode',
|
|
322
|
+
'querystring',
|
|
323
|
+
'readline',
|
|
324
|
+
'readline/promises',
|
|
325
|
+
'repl',
|
|
326
|
+
'sqlite',
|
|
327
|
+
'stream',
|
|
328
|
+
'stream/promises',
|
|
329
|
+
'string_decoder',
|
|
330
|
+
'test',
|
|
331
|
+
'timers',
|
|
332
|
+
'timers/promises',
|
|
333
|
+
'tls',
|
|
334
|
+
'trace_events',
|
|
335
|
+
'tty',
|
|
336
|
+
'url',
|
|
337
|
+
'util',
|
|
338
|
+
'util/types',
|
|
339
|
+
'v8',
|
|
340
|
+
'vm',
|
|
341
|
+
'wasi',
|
|
342
|
+
'worker_threads',
|
|
343
|
+
'zlib',
|
|
344
|
+
]);
|
|
345
|
+
|
|
255
346
|
/** @type {import('eslint').JSRuleDefinition} */
|
|
256
347
|
var validServerActionsPathRule = {
|
|
257
348
|
meta: {
|
|
258
349
|
type: 'problem',
|
|
259
350
|
docs: {
|
|
260
351
|
description: 'enforce server actions are exported from file paths that match "app/**/_actions.ts" or "app/**/_actions/**/*.ts"',
|
|
352
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebvalid-server-actions-path',
|
|
261
353
|
},
|
|
262
354
|
schema: [],
|
|
263
355
|
messages: {
|
|
@@ -300,54 +392,27 @@ const plugin = {
|
|
|
300
392
|
'ban-lodash-import': banLodashImport,
|
|
301
393
|
'css-module-name-matches': cssModuleNameMatchesRule,
|
|
302
394
|
'css-module-class-exists': cssModuleClassExistsRule,
|
|
395
|
+
'no-legacy-node-import': noLegacyNodeImport,
|
|
303
396
|
'valid-server-actions-path': validServerActionsPathRule,
|
|
304
397
|
},
|
|
305
398
|
};
|
|
306
|
-
Object.
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
'friendsoftheweb/css-module-name-matches': 'error',
|
|
315
|
-
'friendsoftheweb/css-module-class-exists': 'error',
|
|
316
|
-
'friendsoftheweb/valid-server-actions-path': 'error',
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
],
|
|
320
|
-
'flat/migrate': [
|
|
321
|
-
{
|
|
322
|
-
plugins: {
|
|
323
|
-
friendsoftheweb: plugin,
|
|
324
|
-
},
|
|
325
|
-
rules: {
|
|
326
|
-
'friendsoftheweb/ban-lodash-import': 'warn',
|
|
327
|
-
'friendsoftheweb/css-module-name-matches': 'warn',
|
|
328
|
-
'friendsoftheweb/css-module-class-exists': 'warn',
|
|
329
|
-
'friendsoftheweb/valid-server-actions-path': 'warn',
|
|
330
|
-
},
|
|
399
|
+
const RULE_NAMES = Object.keys(plugin.rules).map((ruleName) => `friendsoftheweb/${ruleName}`);
|
|
400
|
+
/**
|
|
401
|
+
* @param {'error' | 'warn'} reportLevel
|
|
402
|
+
*/
|
|
403
|
+
function buildConfig(reportLevel) {
|
|
404
|
+
return {
|
|
405
|
+
plugins: {
|
|
406
|
+
friendsoftheweb: plugin,
|
|
331
407
|
},
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
|
-
migrate: {
|
|
343
|
-
plugins: { friendsoftheweb: plugin },
|
|
344
|
-
rules: {
|
|
345
|
-
'friendsoftheweb/ban-lodash-import': 'warn',
|
|
346
|
-
'friendsoftheweb/css-module-name-matches': 'warn',
|
|
347
|
-
'friendsoftheweb/css-module-class-exists': 'warn',
|
|
348
|
-
'friendsoftheweb/valid-server-actions-path': 'warn',
|
|
349
|
-
},
|
|
350
|
-
},
|
|
408
|
+
rules: Object.fromEntries(RULE_NAMES.map((ruleName) => [ruleName, reportLevel])),
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
Object.assign(plugin.configs, {
|
|
412
|
+
'flat/recommended': [buildConfig('error')],
|
|
413
|
+
'flat/migrate': [buildConfig('warn')],
|
|
414
|
+
recommended: buildConfig('error'),
|
|
415
|
+
migrate: buildConfig('warn'),
|
|
351
416
|
});
|
|
352
417
|
|
|
353
418
|
module.exports = plugin;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -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/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 },\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 },\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 },\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","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 },\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 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 'valid-server-actions-path': validServerActionsPathRule,\n },\n};\n\nObject.assign(plugin.configs, {\n 'flat/recommended': [\n {\n plugins: {\n friendsoftheweb: plugin,\n },\n rules: {\n 'friendsoftheweb/ban-lodash-import': 'error',\n 'friendsoftheweb/css-module-name-matches': 'error',\n 'friendsoftheweb/css-module-class-exists': 'error',\n 'friendsoftheweb/valid-server-actions-path': 'error',\n },\n },\n ],\n\n 'flat/migrate': [\n {\n plugins: {\n friendsoftheweb: plugin,\n },\n rules: {\n 'friendsoftheweb/ban-lodash-import': 'warn',\n 'friendsoftheweb/css-module-name-matches': 'warn',\n 'friendsoftheweb/css-module-class-exists': 'warn',\n 'friendsoftheweb/valid-server-actions-path': 'warn',\n },\n },\n ],\n\n recommended: {\n plugins: { friendsoftheweb: plugin },\n rules: {\n 'friendsoftheweb/ban-lodash-import': 'error',\n 'friendsoftheweb/css-module-name-matches': 'error',\n 'friendsoftheweb/css-module-class-exists': 'error',\n 'friendsoftheweb/valid-server-actions-path': 'error',\n },\n },\n\n migrate: {\n plugins: { friendsoftheweb: plugin },\n rules: {\n 'friendsoftheweb/ban-lodash-import': 'warn',\n 'friendsoftheweb/css-module-name-matches': 'warn',\n 'friendsoftheweb/css-module-class-exists': 'warn',\n 'friendsoftheweb/valid-server-actions-path': 'warn',\n },\n },\n});\n\nexport default plugin;\n"],"names":["parse"],"mappings":";;;;;;;;;;;;;AAAA;AACA,sBAAe;AACb,IAAA,IAAI,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AAA,2CAA2C,EAAE,MAAM;AACpD,aAAA;AACF,SAAA;AACF,KAAA;AAED,IAAA,WAAW,EAAE;AACX,QAAA,OAAO,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE;AACpC,QAAA,KAAK,EAAE;AACL,YAAA,mCAAmC,EAAE,OAAO;AAC5C,YAAA,yCAAyC,EAAE,OAAO;AAClD,YAAA,yCAAyC,EAAE,OAAO;AAClD,YAAA,2CAA2C,EAAE,OAAO;AACrD,SAAA;AACF,KAAA;AAED,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE;AACpC,QAAA,KAAK,EAAE;AACL,YAAA,mCAAmC,EAAE,MAAM;AAC3C,YAAA,yCAAyC,EAAE,MAAM;AACjD,YAAA,yCAAyC,EAAE,MAAM;AACjD,YAAA,2CAA2C,EAAE,MAAM;AACpD,SAAA;AACF,KAAA;AACF,CAAA,CAAC;;;;"}
|
|
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,CAAC,IAAI,EAAA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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;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,7 +4,7 @@ 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.
|
|
7
|
+
var version = "0.0.3-beta.0";
|
|
8
8
|
var packageJson = {
|
|
9
9
|
name: name,
|
|
10
10
|
version: version};
|
|
@@ -16,6 +16,7 @@ var banLodashImport = {
|
|
|
16
16
|
fixable: 'code',
|
|
17
17
|
docs: {
|
|
18
18
|
description: 'enforce importing functions from `lodash-es` instead of `lodash`',
|
|
19
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebban-lodash-import',
|
|
19
20
|
},
|
|
20
21
|
schema: [],
|
|
21
22
|
messages: {
|
|
@@ -58,6 +59,7 @@ var cssModuleNameMatchesRule = {
|
|
|
58
59
|
type: 'problem',
|
|
59
60
|
docs: {
|
|
60
61
|
description: "enforce that a CSS module's filename matches the filename of the importing file",
|
|
62
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-name-matches',
|
|
61
63
|
},
|
|
62
64
|
schema: [],
|
|
63
65
|
messages: {
|
|
@@ -95,6 +97,7 @@ var cssModuleClassExistsRule = {
|
|
|
95
97
|
type: 'problem',
|
|
96
98
|
docs: {
|
|
97
99
|
description: 'enforce that class names used from an imported CSS module exist in the module file',
|
|
100
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebcss-module-class-exists',
|
|
98
101
|
},
|
|
99
102
|
schema: [],
|
|
100
103
|
messages: {
|
|
@@ -250,12 +253,101 @@ var cssModuleClassExistsRule = {
|
|
|
250
253
|
},
|
|
251
254
|
};
|
|
252
255
|
|
|
256
|
+
/** @type {import('eslint').JSRuleDefinition} */
|
|
257
|
+
var noLegacyNodeImport = {
|
|
258
|
+
meta: {
|
|
259
|
+
type: 'problem',
|
|
260
|
+
fixable: 'code',
|
|
261
|
+
docs: {
|
|
262
|
+
description: 'enforce importing node standard library modules using `node:` prefix',
|
|
263
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebno-legacy-node-import',
|
|
264
|
+
},
|
|
265
|
+
schema: [],
|
|
266
|
+
messages: {
|
|
267
|
+
invalidImport: 'Node standard library modules must be imported using the "node:" prefix (e.g. "node:{{moduleName}}")',
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
create(context) {
|
|
271
|
+
return {
|
|
272
|
+
ImportDeclaration(node) {
|
|
273
|
+
if (typeof node.source.value !== 'string' ||
|
|
274
|
+
!NODE_STANDARD_MODULES.includes(node.source.value)) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
context.report({
|
|
278
|
+
node,
|
|
279
|
+
messageId: 'invalidImport',
|
|
280
|
+
data: { moduleName: node.source.value },
|
|
281
|
+
fix(fixer) {
|
|
282
|
+
if (typeof node.source.value !== 'string') {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
const newImportPath = `node:${node.source.value}`;
|
|
286
|
+
const quote = node.source.raw[0]; // preserve original quote style
|
|
287
|
+
return fixer.replaceText(node.source, `${quote}${newImportPath}${quote}`);
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
const NODE_STANDARD_MODULES = Object.freeze([
|
|
295
|
+
'assert',
|
|
296
|
+
'assert/strict',
|
|
297
|
+
'async_hooks',
|
|
298
|
+
'buffer',
|
|
299
|
+
'child_process',
|
|
300
|
+
'cluster',
|
|
301
|
+
'console',
|
|
302
|
+
'crypto',
|
|
303
|
+
'dns',
|
|
304
|
+
'dns/promises',
|
|
305
|
+
'domain',
|
|
306
|
+
'events',
|
|
307
|
+
'fs',
|
|
308
|
+
'fs/promises',
|
|
309
|
+
'http',
|
|
310
|
+
'http2',
|
|
311
|
+
'https',
|
|
312
|
+
'inspector',
|
|
313
|
+
'module',
|
|
314
|
+
'net',
|
|
315
|
+
'os',
|
|
316
|
+
'path',
|
|
317
|
+
'perf_hooks',
|
|
318
|
+
'process',
|
|
319
|
+
'punycode',
|
|
320
|
+
'querystring',
|
|
321
|
+
'readline',
|
|
322
|
+
'readline/promises',
|
|
323
|
+
'repl',
|
|
324
|
+
'sqlite',
|
|
325
|
+
'stream',
|
|
326
|
+
'stream/promises',
|
|
327
|
+
'string_decoder',
|
|
328
|
+
'test',
|
|
329
|
+
'timers',
|
|
330
|
+
'timers/promises',
|
|
331
|
+
'tls',
|
|
332
|
+
'trace_events',
|
|
333
|
+
'tty',
|
|
334
|
+
'url',
|
|
335
|
+
'util',
|
|
336
|
+
'util/types',
|
|
337
|
+
'v8',
|
|
338
|
+
'vm',
|
|
339
|
+
'wasi',
|
|
340
|
+
'worker_threads',
|
|
341
|
+
'zlib',
|
|
342
|
+
]);
|
|
343
|
+
|
|
253
344
|
/** @type {import('eslint').JSRuleDefinition} */
|
|
254
345
|
var validServerActionsPathRule = {
|
|
255
346
|
meta: {
|
|
256
347
|
type: 'problem',
|
|
257
348
|
docs: {
|
|
258
349
|
description: 'enforce server actions are exported from file paths that match "app/**/_actions.ts" or "app/**/_actions/**/*.ts"',
|
|
350
|
+
url: 'https://github.com/friendsoftheweb/eslint-plugin#friendsofthewebvalid-server-actions-path',
|
|
259
351
|
},
|
|
260
352
|
schema: [],
|
|
261
353
|
messages: {
|
|
@@ -298,54 +390,27 @@ const plugin = {
|
|
|
298
390
|
'ban-lodash-import': banLodashImport,
|
|
299
391
|
'css-module-name-matches': cssModuleNameMatchesRule,
|
|
300
392
|
'css-module-class-exists': cssModuleClassExistsRule,
|
|
393
|
+
'no-legacy-node-import': noLegacyNodeImport,
|
|
301
394
|
'valid-server-actions-path': validServerActionsPathRule,
|
|
302
395
|
},
|
|
303
396
|
};
|
|
304
|
-
Object.
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
'friendsoftheweb/css-module-name-matches': 'error',
|
|
313
|
-
'friendsoftheweb/css-module-class-exists': 'error',
|
|
314
|
-
'friendsoftheweb/valid-server-actions-path': 'error',
|
|
315
|
-
},
|
|
316
|
-
},
|
|
317
|
-
],
|
|
318
|
-
'flat/migrate': [
|
|
319
|
-
{
|
|
320
|
-
plugins: {
|
|
321
|
-
friendsoftheweb: plugin,
|
|
322
|
-
},
|
|
323
|
-
rules: {
|
|
324
|
-
'friendsoftheweb/ban-lodash-import': 'warn',
|
|
325
|
-
'friendsoftheweb/css-module-name-matches': 'warn',
|
|
326
|
-
'friendsoftheweb/css-module-class-exists': 'warn',
|
|
327
|
-
'friendsoftheweb/valid-server-actions-path': 'warn',
|
|
328
|
-
},
|
|
397
|
+
const RULE_NAMES = Object.keys(plugin.rules).map((ruleName) => `friendsoftheweb/${ruleName}`);
|
|
398
|
+
/**
|
|
399
|
+
* @param {'error' | 'warn'} reportLevel
|
|
400
|
+
*/
|
|
401
|
+
function buildConfig(reportLevel) {
|
|
402
|
+
return {
|
|
403
|
+
plugins: {
|
|
404
|
+
friendsoftheweb: plugin,
|
|
329
405
|
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
migrate: {
|
|
341
|
-
plugins: { friendsoftheweb: plugin },
|
|
342
|
-
rules: {
|
|
343
|
-
'friendsoftheweb/ban-lodash-import': 'warn',
|
|
344
|
-
'friendsoftheweb/css-module-name-matches': 'warn',
|
|
345
|
-
'friendsoftheweb/css-module-class-exists': 'warn',
|
|
346
|
-
'friendsoftheweb/valid-server-actions-path': 'warn',
|
|
347
|
-
},
|
|
348
|
-
},
|
|
406
|
+
rules: Object.fromEntries(RULE_NAMES.map((ruleName) => [ruleName, reportLevel])),
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
Object.assign(plugin.configs, {
|
|
410
|
+
'flat/recommended': [buildConfig('error')],
|
|
411
|
+
'flat/migrate': [buildConfig('warn')],
|
|
412
|
+
recommended: buildConfig('error'),
|
|
413
|
+
migrate: buildConfig('warn'),
|
|
349
414
|
});
|
|
350
415
|
|
|
351
416
|
export { plugin as default };
|
package/dist/esm/index.js.map
CHANGED
|
@@ -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/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 },\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 },\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 },\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","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 },\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 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 'valid-server-actions-path': validServerActionsPathRule,\n },\n};\n\nObject.assign(plugin.configs, {\n 'flat/recommended': [\n {\n plugins: {\n friendsoftheweb: plugin,\n },\n rules: {\n 'friendsoftheweb/ban-lodash-import': 'error',\n 'friendsoftheweb/css-module-name-matches': 'error',\n 'friendsoftheweb/css-module-class-exists': 'error',\n 'friendsoftheweb/valid-server-actions-path': 'error',\n },\n },\n ],\n\n 'flat/migrate': [\n {\n plugins: {\n friendsoftheweb: plugin,\n },\n rules: {\n 'friendsoftheweb/ban-lodash-import': 'warn',\n 'friendsoftheweb/css-module-name-matches': 'warn',\n 'friendsoftheweb/css-module-class-exists': 'warn',\n 'friendsoftheweb/valid-server-actions-path': 'warn',\n },\n },\n ],\n\n recommended: {\n plugins: { friendsoftheweb: plugin },\n rules: {\n 'friendsoftheweb/ban-lodash-import': 'error',\n 'friendsoftheweb/css-module-name-matches': 'error',\n 'friendsoftheweb/css-module-class-exists': 'error',\n 'friendsoftheweb/valid-server-actions-path': 'error',\n },\n },\n\n migrate: {\n plugins: { friendsoftheweb: plugin },\n rules: {\n 'friendsoftheweb/ban-lodash-import': 'warn',\n 'friendsoftheweb/css-module-name-matches': 'warn',\n 'friendsoftheweb/css-module-class-exists': 'warn',\n 'friend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AAE;AACL,gBAAA,mCAAmC,EAAE,MAAM;AAC3C,gBAAA,yCAAyC,EAAE,MAAM;AACjD,gBAAA,yCAAyC,EAAE,MAAM;AACjD,gBAAA,2CAA2C,EAAE,MAAM;AACpD,aAAA;AACF,SAAA;AACF,KAAA;AAED,IAAA,WAAW,EAAE;AACX,QAAA,OAAO,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE;AACpC,QAAA,KAAK,EAAE;AACL,YAAA,mCAAmC,EAAE,OAAO;AAC5C,YAAA,yCAAyC,EAAE,OAAO;AAClD,YAAA,yCAAyC,EAAE,OAAO;AAClD,YAAA,2CAA2C,EAAE,OAAO;AACrD,SAAA;AACF,KAAA;AAED,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE;AACpC,QAAA,KAAK,EAAE;AACL,YAAA,mCAAmC,EAAE,MAAM;AAC3C,YAAA,yCAAyC,EAAE,MAAM;AACjD,YAAA,yCAAyC,EAAE,MAAM;AACjD,YAAA,2CAA2C,EAAE,MAAM;AACpD,SAAA;AACF,KAAA;AACF,CAAA,CAAC;;;;"}
|
|
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;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,iEAAi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AAC,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;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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[];
|