@taiga-ui/eslint-plugin-experience-next 0.345.0 → 0.347.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/index.d.ts +1 -0
- package/index.esm.js +68 -7
- package/package.json +2 -1
- package/rules/no-deep-imports-to-indexed-packages.d.ts +3 -0
package/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare const plugin: {
|
|
|
15
15
|
'decorator-key-sort': import("eslint").Rule.RuleModule;
|
|
16
16
|
'injection-token-description': import("eslint").Rule.RuleModule;
|
|
17
17
|
'no-deep-imports': import("eslint").Rule.RuleModule;
|
|
18
|
+
'no-deep-imports-to-indexed-packages': import("@typescript-eslint/utils/ts-eslint").RuleModule<"deepImport", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
18
19
|
'no-href-with-router-link': import("eslint").Rule.RuleModule;
|
|
19
20
|
'no-implicit-public': import("eslint").Rule.RuleModule;
|
|
20
21
|
'no-private-esnext-fields': import("eslint").Rule.RuleModule;
|
package/index.esm.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { readFileSync
|
|
1
|
+
import fs, { readFileSync } from 'node:fs';
|
|
2
2
|
import html from '@html-eslint/eslint-plugin';
|
|
3
3
|
import htmlParser from '@html-eslint/parser';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
4
5
|
import eslint from '@eslint/js';
|
|
5
6
|
import rxjs from '@smarttools/eslint-plugin-rxjs';
|
|
6
7
|
import stylistic from '@stylistic/eslint-plugin';
|
|
7
8
|
import angular from 'angular-eslint';
|
|
9
|
+
import compat from 'eslint-plugin-compat';
|
|
8
10
|
import progress from 'eslint-plugin-file-progress';
|
|
9
11
|
import jest from 'eslint-plugin-jest';
|
|
10
12
|
import playwright from 'eslint-plugin-playwright';
|
|
@@ -14,9 +16,7 @@ import sonarjs from 'eslint-plugin-sonarjs';
|
|
|
14
16
|
import unicorn from 'eslint-plugin-unicorn';
|
|
15
17
|
import unusedImports from 'eslint-plugin-unused-imports';
|
|
16
18
|
import globals from 'globals';
|
|
17
|
-
import { createRequire } from 'module';
|
|
18
19
|
import tseslint from 'typescript-eslint';
|
|
19
|
-
import fs, { readFileSync } from 'node:fs';
|
|
20
20
|
import { globSync } from 'glob';
|
|
21
21
|
import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
22
22
|
import ts from 'typescript';
|
|
@@ -222,7 +222,7 @@ try {
|
|
|
222
222
|
}
|
|
223
223
|
catch { }
|
|
224
224
|
const ALL_TS_JS_FILES = ['**/*.{js,mjs,ts,cjs,tsx,jsx}'];
|
|
225
|
-
var recommended = tseslint.config(progress.configs['recommended-ci'], require('eslint-plugin-de-morgan').configs.recommended, require('eslint-plugin-import').flatConfigs.recommended, require('eslint-plugin-import').flatConfigs.typescript, require('eslint-plugin-promise').configs['flat/recommended'], {
|
|
225
|
+
var recommended = tseslint.config(compat.configs['flat/recommended'], progress.configs['recommended-ci'], require('eslint-plugin-de-morgan').configs.recommended, require('eslint-plugin-import').flatConfigs.recommended, require('eslint-plugin-import').flatConfigs.typescript, require('eslint-plugin-promise').configs['flat/recommended'], {
|
|
226
226
|
ignores: [
|
|
227
227
|
'*/icons/all.ts',
|
|
228
228
|
'**/tests-report/**',
|
|
@@ -419,6 +419,7 @@ var recommended = tseslint.config(progress.configs['recommended-ci'], require('e
|
|
|
419
419
|
],
|
|
420
420
|
},
|
|
421
421
|
],
|
|
422
|
+
'@taiga-ui/experience-next/no-deep-imports-to-indexed-packages': 'error',
|
|
422
423
|
'@taiga-ui/experience-next/no-implicit-public': 'error',
|
|
423
424
|
'@taiga-ui/experience-next/no-private-esnext-fields': 'error',
|
|
424
425
|
'@taiga-ui/experience-next/standalone-imports-sort': 'error',
|
|
@@ -653,6 +654,7 @@ var recommended = tseslint.config(progress.configs['recommended-ci'], require('e
|
|
|
653
654
|
],
|
|
654
655
|
'guard-for-in': 'error',
|
|
655
656
|
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
|
|
657
|
+
'import/enforce-node-protocol-usage': ['error', 'always'],
|
|
656
658
|
'import/first': 'error',
|
|
657
659
|
'import/newline-after-import': ['error', { count: 1 }],
|
|
658
660
|
'import/no-absolute-path': 'error',
|
|
@@ -1009,6 +1011,7 @@ var recommended = tseslint.config(progress.configs['recommended-ci'], require('e
|
|
|
1009
1011
|
rules: {
|
|
1010
1012
|
...playwright.configs['flat/recommended'].rules,
|
|
1011
1013
|
'playwright/no-networkidle': 'off',
|
|
1014
|
+
'compat/compat': 'off',
|
|
1012
1015
|
'jest/prefer-importing-jest-globals': 'off',
|
|
1013
1016
|
'playwright/expect-expect': [
|
|
1014
1017
|
'error',
|
|
@@ -1028,6 +1031,7 @@ var recommended = tseslint.config(progress.configs['recommended-ci'], require('e
|
|
|
1028
1031
|
...jest.configs['flat/recommended'].rules,
|
|
1029
1032
|
'@typescript-eslint/no-extraneous-class': 'off',
|
|
1030
1033
|
'@typescript-eslint/no-shadow': 'off',
|
|
1034
|
+
'compat/compat': 'off',
|
|
1031
1035
|
'jest/expect-expect': 'off',
|
|
1032
1036
|
'jest/max-expects': 'off',
|
|
1033
1037
|
'jest/max-nested-describe': 'off',
|
|
@@ -1090,6 +1094,7 @@ var recommended = tseslint.config(progress.configs['recommended-ci'], require('e
|
|
|
1090
1094
|
}, {
|
|
1091
1095
|
files: ['**/*.cy.ts'],
|
|
1092
1096
|
rules: {
|
|
1097
|
+
'compat/compat': 'off',
|
|
1093
1098
|
'cypress/no-unnecessary-waiting': 'off',
|
|
1094
1099
|
'cypress/unsafe-to-chain-command': 'off',
|
|
1095
1100
|
'max-nested-callbacks': 'off',
|
|
@@ -1449,8 +1454,8 @@ function intersect(a, b) {
|
|
|
1449
1454
|
return a.some((type) => origin.has(type));
|
|
1450
1455
|
}
|
|
1451
1456
|
|
|
1452
|
-
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
1453
|
-
var classPropertyNaming = createRule({
|
|
1457
|
+
const createRule$1 = ESLintUtils.RuleCreator((name) => name);
|
|
1458
|
+
var classPropertyNaming = createRule$1({
|
|
1454
1459
|
create(context, [configs]) {
|
|
1455
1460
|
const parserServices = ESLintUtils.getParserServices(context);
|
|
1456
1461
|
const typeChecker = parserServices.program.getTypeChecker();
|
|
@@ -1700,6 +1705,61 @@ const config$6 = {
|
|
|
1700
1705
|
},
|
|
1701
1706
|
};
|
|
1702
1707
|
|
|
1708
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
1709
|
+
var noDeepImportsToIndexedPackages = createRule({
|
|
1710
|
+
create(context) {
|
|
1711
|
+
const parserServices = ESLintUtils.getParserServices(context);
|
|
1712
|
+
const program = parserServices.program;
|
|
1713
|
+
const compilerHost = ts.createCompilerHost(program.getCompilerOptions(), true);
|
|
1714
|
+
return {
|
|
1715
|
+
ImportDeclaration(node) {
|
|
1716
|
+
const importPath = node.source.value;
|
|
1717
|
+
if (typeof importPath !== 'string' || importPath.startsWith('.')) {
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
const containingFile = context.filename;
|
|
1721
|
+
const { resolvedModule } = ts.resolveModuleName(importPath, containingFile, program.getCompilerOptions(), compilerHost);
|
|
1722
|
+
const resolvedPath = resolvedModule?.resolvedFileName;
|
|
1723
|
+
if (!resolvedPath || resolvedPath.endsWith('index.ts')) {
|
|
1724
|
+
return;
|
|
1725
|
+
}
|
|
1726
|
+
const dir = path.dirname(resolvedPath);
|
|
1727
|
+
const baseDir = path.resolve(dir, '..');
|
|
1728
|
+
const indexPath = path.join(baseDir, 'index.ts');
|
|
1729
|
+
const ngPackagePath = path.join(baseDir, 'ng-package.json');
|
|
1730
|
+
const packageJsonPath = path.join(baseDir, 'package.json');
|
|
1731
|
+
const hasIndex = fs.existsSync(indexPath);
|
|
1732
|
+
const hasPackage = fs.existsSync(ngPackagePath) || fs.existsSync(packageJsonPath);
|
|
1733
|
+
if (hasIndex && hasPackage) {
|
|
1734
|
+
const relative = path.relative(baseDir, resolvedPath);
|
|
1735
|
+
const shouldFix = !!(relative && !relative.startsWith('..'));
|
|
1736
|
+
if (shouldFix) {
|
|
1737
|
+
const parts = importPath.split('/');
|
|
1738
|
+
const suggestedImport = parts.slice(0, -1).join('/');
|
|
1739
|
+
context.report({
|
|
1740
|
+
data: { importPath, suggestedImport },
|
|
1741
|
+
messageId: 'deepImport',
|
|
1742
|
+
node: node.source,
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
},
|
|
1747
|
+
};
|
|
1748
|
+
},
|
|
1749
|
+
defaultOptions: [],
|
|
1750
|
+
meta: {
|
|
1751
|
+
docs: {
|
|
1752
|
+
description: 'Disallow deep imports from packages that expose an index.ts next to ng-package.json or package.json',
|
|
1753
|
+
},
|
|
1754
|
+
messages: {
|
|
1755
|
+
deepImport: 'Import "{{importPath}}" should go through the package index.ts (use "{{suggestedImport}}").',
|
|
1756
|
+
},
|
|
1757
|
+
schema: [],
|
|
1758
|
+
type: 'problem',
|
|
1759
|
+
},
|
|
1760
|
+
name: 'no-deep-imports-to-indexed-packages',
|
|
1761
|
+
});
|
|
1762
|
+
|
|
1703
1763
|
const MESSAGE_ID$1 = 'no-href-with-router-link';
|
|
1704
1764
|
const ERROR_MESSAGE$1 = 'Do not use href and routerLink attributes together on the same element';
|
|
1705
1765
|
const config$5 = {
|
|
@@ -2051,7 +2111,7 @@ const config = {
|
|
|
2051
2111
|
},
|
|
2052
2112
|
};
|
|
2053
2113
|
|
|
2054
|
-
const pkg = JSON.parse(readFileSync
|
|
2114
|
+
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
|
|
2055
2115
|
const plugin = {
|
|
2056
2116
|
configs: {},
|
|
2057
2117
|
meta: {
|
|
@@ -2064,6 +2124,7 @@ const plugin = {
|
|
|
2064
2124
|
'decorator-key-sort': config$8,
|
|
2065
2125
|
'injection-token-description': config$7,
|
|
2066
2126
|
'no-deep-imports': config$6,
|
|
2127
|
+
'no-deep-imports-to-indexed-packages': noDeepImportsToIndexedPackages,
|
|
2067
2128
|
'no-href-with-router-link': config$5,
|
|
2068
2129
|
'no-implicit-public': config$4,
|
|
2069
2130
|
'no-private-esnext-fields': config$3,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taiga-ui/eslint-plugin-experience-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.347.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",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"angular-eslint": "^20.4.0",
|
|
19
19
|
"eslint": "^9.37.0",
|
|
20
20
|
"eslint-config-prettier": "^10.1.7",
|
|
21
|
+
"eslint-plugin-compat": "^6.0.2",
|
|
21
22
|
"eslint-plugin-de-morgan": "^2.0.0",
|
|
22
23
|
"eslint-plugin-decorator-position": "^6.0.0",
|
|
23
24
|
"eslint-plugin-file-progress": "^3.0.2",
|