@taiga-ui/eslint-plugin-experience-next 0.425.0 → 0.426.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.
Files changed (2) hide show
  1. package/index.esm.js +20 -5
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1597,7 +1597,16 @@ const rule$6 = createRule$9({
1597
1597
 
1598
1598
  const MESSAGE_ID$3 = 'no-deep-imports';
1599
1599
  const ERROR_MESSAGE$2 = 'Deep imports of Taiga UI packages are prohibited';
1600
- const ASSET_EXTENSIONS = /\.(?:svg|png|jpe?g|webp|gif)(?:\?.*)?$/i;
1600
+ const CODE_EXTENSIONS = new Set([
1601
+ '.cjs',
1602
+ '.cts',
1603
+ '.js',
1604
+ '.jsx',
1605
+ '.mjs',
1606
+ '.mts',
1607
+ '.ts',
1608
+ '.tsx',
1609
+ ]);
1601
1610
  const DEFAULT_OPTIONS = {
1602
1611
  currentProject: '',
1603
1612
  deepImport: String.raw `(?<=^@taiga-ui/[\w-]+)(/.+)$`,
@@ -1609,7 +1618,14 @@ const createRule$8 = ESLintUtils.RuleCreator((name) => name);
1609
1618
  const rule$5 = createRule$8({
1610
1619
  create(context) {
1611
1620
  const { currentProject, deepImport, ignoreImports, importDeclaration, projectName, } = { ...DEFAULT_OPTIONS, ...context.options[0] };
1612
- const isAssetImport = (source) => !!source && ASSET_EXTENSIONS.test(source);
1621
+ const hasNonCodeExtension = (source) => {
1622
+ if (!source) {
1623
+ return false;
1624
+ }
1625
+ const cleanSource = source.split(/[?#]/, 1)[0] ?? '';
1626
+ const extension = path.posix.extname(cleanSource).toLowerCase();
1627
+ return !!extension && !CODE_EXTENSIONS.has(extension);
1628
+ };
1613
1629
  const isDeepImport = (source) => !!source && new RegExp(deepImport, 'g').test(source);
1614
1630
  const isSideEffectImport = (node) => node.specifiers.length === 0;
1615
1631
  const isInsideTheSameEntryPoint = (source) => {
@@ -1633,14 +1649,13 @@ const rule$5 = createRule$8({
1633
1649
  !isDeepImport(importSource) ||
1634
1650
  isInsideTheSameEntryPoint(importSource) ||
1635
1651
  shouldIgnore(importSource) ||
1636
- isAssetImport(importSource)) {
1652
+ hasNonCodeExtension(importSource)) {
1637
1653
  return;
1638
1654
  }
1639
1655
  context.report({
1640
1656
  fix: (fixer) => {
1641
1657
  const [start, end] = node.source.range;
1642
- return fixer.replaceTextRange([start + 1, end - 1], // keep quotes
1643
- importSource.replaceAll(new RegExp(deepImport, 'g'), ''));
1658
+ return fixer.replaceTextRange([start + 1, end - 1], importSource.replaceAll(new RegExp(deepImport, 'g'), ''));
1644
1659
  },
1645
1660
  messageId: MESSAGE_ID$3,
1646
1661
  node: node.source,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ui/eslint-plugin-experience-next",
3
- "version": "0.425.0",
3
+ "version": "0.426.0",
4
4
  "description": "An ESLint plugin to enforce a consistent code styles across taiga-ui projects",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",