mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
Fixed build for all the packages
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
"projectRoot": "lib/eslint-angular",
|
||||
"outputPath": "dist/libs/eslint-plugin-eslint-angular",
|
||||
"main": "lib/eslint-angular/index.ts",
|
||||
"generatePackageJson": true,
|
||||
"tsConfig": "lib/eslint-angular/tsconfig.lib.prod.json",
|
||||
"webpackConfig": "lib/eslint-angular/webpack.config.js",
|
||||
"stylePreprocessorOptions": {
|
||||
"includePaths": ["lib", "lib/core/src/lib"]
|
||||
},
|
||||
@@ -24,14 +24,13 @@
|
||||
"projectRoot": "lib/eslint-angular",
|
||||
"outputPath": "dist/libs/eslint-plugin-eslint-angular",
|
||||
"main": "lib/eslint-angular/index.ts",
|
||||
"generatePackageJson": true,
|
||||
"tsConfig": "lib/eslint-angular/tsconfig.lib.prod.json"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nrwl/linter:eslint",
|
||||
"executor": "@nx/eslint:lint:eslint",
|
||||
"options": {
|
||||
"lintFilePatterns": ["lib/eslint-angular/**/*.ts"]
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ const messages = {
|
||||
|
||||
type MessageIds = keyof typeof messages;
|
||||
|
||||
const filetypeErrors: {regexp: RegExp; messageId: MessageIds}[] = [
|
||||
const filetypeErrors: { regexp: RegExp; messageId: MessageIds }[] = [
|
||||
{
|
||||
regexp: /.*\.spec\.ts/,
|
||||
messageId: 'useAngularMaterialTestingHarness'
|
||||
@@ -52,8 +52,7 @@ export default createESLintRule<unknown[], MessageIds>({
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Disallows using Angular Material internal selectors',
|
||||
recommended: 'error'
|
||||
description: 'Disallows using Angular Material internal selectors'
|
||||
},
|
||||
hasSuggestions: true,
|
||||
schema: [],
|
||||
@@ -63,9 +62,9 @@ export default createESLintRule<unknown[], MessageIds>({
|
||||
create(context) {
|
||||
return {
|
||||
[ASTSelectors.join(',')](node: TSESTree.Literal | TSESTree.TemplateLiteral) {
|
||||
const message = filetypeErrors.find((fileTypeError) =>
|
||||
context.getFilename().match(fileTypeError.regexp)
|
||||
) || { messageId: 'noAngularMaterialSelectors' };
|
||||
const message = filetypeErrors.find((fileTypeError) => context.getFilename().match(fileTypeError.regexp)) || {
|
||||
messageId: 'noAngularMaterialSelectors'
|
||||
};
|
||||
|
||||
context.report({
|
||||
node,
|
||||
|
@@ -21,7 +21,7 @@ import { createESLintRule } from '../../utils/create-eslint-rule/create-eslint-r
|
||||
|
||||
export const RULE_NAME = 'use-none-component-view-encapsulation';
|
||||
|
||||
type MessageIds = 'useNoneComponentViewEncapsulation'| 'suggestAddViewEncapsulationNone';
|
||||
type MessageIds = 'useNoneComponentViewEncapsulation' | 'suggestAddViewEncapsulationNone';
|
||||
type DecoratorForClass = TSESTree.Decorator & {
|
||||
parent: TSESTree.ClassDeclaration;
|
||||
};
|
||||
@@ -53,8 +53,7 @@ export default createESLintRule<unknown[], MessageIds>({
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: `Disallows using other encapsulation than \`${viewEncapsulationNone}\``,
|
||||
recommended: false
|
||||
description: `Disallows using other encapsulation than \`${viewEncapsulationNone}\``
|
||||
},
|
||||
hasSuggestions: true,
|
||||
schema: [],
|
||||
@@ -65,18 +64,13 @@ export default createESLintRule<unknown[], MessageIds>({
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
const encapsulationProperty = Selectors.metadataProperty(
|
||||
metadataPropertyName
|
||||
);
|
||||
const encapsulationProperty = Selectors.metadataProperty(metadataPropertyName);
|
||||
const withoutEncapsulationProperty =
|
||||
`${Selectors.COMPONENT_CLASS_DECORATOR}:matches([expression.arguments.length=0], [expression.arguments.0.type='ObjectExpression']:not(:has(${encapsulationProperty})))` as const;
|
||||
const nonNoneViewEncapsulationNoneProperty =
|
||||
`${Selectors.COMPONENT_CLASS_DECORATOR} > CallExpression > ObjectExpression > ` +
|
||||
`${encapsulationProperty}:matches([value.type='Identifier'][value.name='undefined'], [value.object.name='ViewEncapsulation'][value.property.name!='None'])`;
|
||||
const selectors = [
|
||||
withoutEncapsulationProperty,
|
||||
nonNoneViewEncapsulationNoneProperty
|
||||
].join(',');
|
||||
const selectors = [withoutEncapsulationProperty, nonNoneViewEncapsulationNoneProperty].join(',');
|
||||
return {
|
||||
[selectors](node: DecoratorForClass | PropertyInClassDecorator) {
|
||||
context.report({
|
||||
@@ -92,7 +86,7 @@ export default createESLintRule<unknown[], MessageIds>({
|
||||
fixer,
|
||||
importName: 'ViewEncapsulation',
|
||||
moduleName: '@angular/core',
|
||||
node: node.parent.parent.parent.parent
|
||||
node: node.parent
|
||||
}),
|
||||
ASTUtils.isMemberExpression(node.value)
|
||||
? fixer.replaceText(node.value.property, 'None')
|
||||
@@ -107,11 +101,7 @@ export default createESLintRule<unknown[], MessageIds>({
|
||||
moduleName: '@angular/core',
|
||||
node: node.parent
|
||||
}),
|
||||
RuleFixes.getDecoratorPropertyAddFix(
|
||||
node,
|
||||
fixer,
|
||||
`${metadataPropertyName}: ${viewEncapsulationNone}`
|
||||
)
|
||||
RuleFixes.getDecoratorPropertyAddFix(node, fixer, `${metadataPropertyName}: ${viewEncapsulationNone}`)
|
||||
].filter(isNotNullOrUndefined);
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
"skipLibCheck": true,
|
||||
"baseUrl": "src",
|
||||
"types": [
|
||||
"node"
|
||||
"node", "@typescript-eslint/utils"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
|
20
lib/eslint-angular/webpack.config.js
Normal file
20
lib/eslint-angular/webpack.config.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
||||
const { join } = require('path');
|
||||
|
||||
module.exports = {
|
||||
output: {
|
||||
path: join(__dirname, '../../dist/libs/eslint-angular')
|
||||
},
|
||||
devServer: {
|
||||
port: 4200
|
||||
},
|
||||
plugins: [
|
||||
new NxAppWebpackPlugin({
|
||||
main: './index.ts',
|
||||
tsConfig: './tsconfig.lib.json',
|
||||
index: './index.ts',
|
||||
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
||||
optimization: process.env['NODE_ENV'] === 'production'
|
||||
})
|
||||
]
|
||||
};
|
Reference in New Issue
Block a user