Skip to content

Commit

Permalink
chore: modular workspace config with nx 12.5 (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry authored Jun 29, 2021
1 parent c8d2321 commit 7c47be9
Show file tree
Hide file tree
Showing 35 changed files with 523 additions and 504 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fetch-depth: 0

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: jameshenry/nx-set-shas@v0.3
uses: nrwl/nx-set-shas@v1
with:
error-on-no-matching-tags: false
main-branch-name: master
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Tag master branch if all jobs succeed
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: jameshenry/nx-tag-successful-ci-run@v0.1
uses: nrwl/nx-tag-successful-ci-run@v1

- name: Stop all running agents for this CI run
# It's important that we always run this step, otherwise in the case of any failures in preceding non-Nx steps, the agents will keep running and waste billable minutes
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
fetch-depth: 0

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: jameshenry/nx-set-shas@v0.3
uses: nrwl/nx-set-shas@v1
with:
error-on-no-matching-tags: false
main-branch-name: master
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,4 +815,6 @@ If you see a rule below that has **no status** against it, then please feel free

<!-- PR Links -->

[`pr559`]: https://api.github.com/repos/angular-eslint/angular-eslint/pulls/559

<!-- end rule list -->
28 changes: 0 additions & 28 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,6 @@
]
},
"projects": {
"builder": {
"implicitDependencies": []
},
"eslint-plugin": {
"implicitDependencies": []
},
"eslint-plugin-template": {
"implicitDependencies": ["template-parser"]
},
"integration-tests": {
"implicitDependencies": [
"builder",
"eslint-plugin",
"eslint-plugin-template",
"schematics",
"template-parser",
"utils"
]
},
"integration-tests-suite-1": {
"implicitDependencies": [
"integration-tests",
Expand Down Expand Up @@ -131,15 +112,6 @@
"template-parser",
"utils"
]
},
"schematics": {
"implicitDependencies": []
},
"template-parser": {
"implicitDependencies": []
},
"utils": {
"implicitDependencies": []
}
},
"affected": {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
"@angular/compiler-cli": "12.0.0",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"@nrwl/cli": "12.4.0",
"@nrwl/nx-cloud": "12.2.4",
"@nrwl/tao": "12.4.0",
"@nrwl/workspace": "12.4.0",
"@nrwl/cli": "12.5.0",
"@nrwl/nx-cloud": "12.2.7",
"@nrwl/tao": "12.5.0",
"@nrwl/workspace": "12.5.0",
"@schematics/angular": "12.0.0",
"@types/eslint": "^7.2.1",
"@types/eslint-scope": "^3.7.0",
Expand All @@ -78,7 +78,7 @@
"lint-staged": "^9.2.0",
"microbundle": "0.13.0",
"ncp": "^2.0.0",
"prettier": "2.0.5",
"prettier": "2.3.2",
"rimraf": "^3.0.2",
"strip-ansi": "^6.0.0",
"terser": "^4.0.0",
Expand Down
46 changes: 46 additions & 0 deletions packages/builder/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"root": "packages/builder",
"type": "library",
"targets": {
"build": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["packages/builder/dist"],
"options": {
"cwd": "packages/builder",
"parallel": false,
"commands": [
"npx rimraf ./dist",
"npx tsc --project tsconfig.build.json",
"terser ./dist/index.js --output=./dist/index.js",
"ncp src/schema.json dist/schema.json"
]
}
},
"test": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["packages/builder/coverage"],
"options": {
"cwd": "packages/builder",
"parallel": false,
"commands": ["npx jest --coverage"]
}
},
"clean": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"cwd": "packages/builder",
"parallel": false,
"commands": ["npx rimraf ./dist"]
}
},
"typecheck": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"cwd": "packages/builder",
"parallel": false,
"commands": ["npx tsc -p tsconfig.json --noEmit"]
}
}
},
"implicitDependencies": []
}
55 changes: 55 additions & 0 deletions packages/eslint-plugin-template/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"root": "packages/eslint-plugin-template",
"type": "library",
"targets": {
"build": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["packages/eslint-plugin-template/dist"],
"options": {
"cwd": "packages/eslint-plugin-template",
"parallel": false,
"commands": [
"npx rimraf ./dist",
"npx microbundle --tsconfig tsconfig.build.json --no-sourcemap --target=node --compress --format=cjs",
"npx ncp ./src/configs ./dist/configs"
]
}
},
"test": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["packages/eslint-plugin-template/coverage"],
"options": {
"cwd": "packages/eslint-plugin-template",
"parallel": false,
"commands": ["npx nx build template-parser", "npx jest --coverage"]
}
},
"clean": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"cwd": "packages/eslint-plugin-template",
"parallel": false,
"commands": ["npx rimraf ./dist"]
}
},
"typecheck": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"cwd": "packages/eslint-plugin-template",
"parallel": false,
"commands": ["npx tsc -p tsconfig.json --noEmit"]
}
},
"check-configs": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"cwd": "packages/eslint-plugin-template",
"parallel": false,
"commands": [
"npx jest tests/configs.test.ts --runTestsByPath --runInBand"
]
}
}
},
"implicitDependencies": ["template-parser"]
}
3 changes: 2 additions & 1 deletion packages/eslint-plugin-template/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ export default {
[accessibilityAltTextRuleName]: accessibilityAltText,
[accessibilityElementsContentRuleName]: accessibilityElementsContent,
[accessibilityLabelForRuleName]: accessibilityLabelFor,
[accessibilityLabelHasAssociatedControlRuleName]: accessibilityLabelHasAssociatedControl,
[accessibilityLabelHasAssociatedControlRuleName]:
accessibilityLabelHasAssociatedControl,
[accessibilityTableScopeRuleName]: accessibilityTableScope,
[accessibilityValidAriaRuleName]: accessibilityValidAria,
[bananaInBoxRuleName]: bananaInBox,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function isValidObjectNode(node: TmplAstElement): boolean {

return (
node.children.length > 0 &&
!!((node.children[0] as unknown) as Node & { value?: unknown }).value
!!(node.children[0] as unknown as Node & { value?: unknown }).value
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ export default createESLintRule<Options, MessageIds>({
],
create(context, [options]) {
const parserServices = getTemplateParserServices(context);
const {
controlComponents,
labelAttributes,
labelComponents,
} = getParsedOptions(options);
const { controlComponents, labelAttributes, labelComponents } =
getParsedOptions(options);
const labelComponentsPattern = toPattern([...labelComponents]);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function isBooleanLike(value: unknown): value is boolean | 'false' | 'true' {
function isInteger(value: unknown): boolean {
return (
!Number.isNaN(value) &&
parseInt((Number(value) as unknown) as string) == value &&
parseInt(Number(value) as unknown as string) == value &&
!Number.isNaN(parseInt(value as string, 10))
);
}
Expand Down Expand Up @@ -172,7 +172,7 @@ function isValidAriaPropertyValue(
case 'token':
case 'tokenlist': {
const parsedAttributeValue = isBooleanLike(attributeValue)
? JSON.parse((attributeValue as unknown) as string)
? JSON.parse(attributeValue as unknown as string)
: attributeValue;
return Boolean(values?.includes(parsedAttributeValue));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ function getParser(): Parser {
}

function getTotalComplexity(ast: AST): number {
const possibleBinaryOrConditional = extractPossibleBinaryOrConditionalFrom(
ast,
);
const possibleBinaryOrConditional =
extractPossibleBinaryOrConditionalFrom(ast);

if (
!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function getTemplateParserServices(
context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>,
): ParserServices {
ensureTemplateParser(context);
return (context.parserServices as unknown) as ParserServices;
return context.parserServices as unknown as ParserServices;
}

/**
Expand All @@ -31,9 +31,9 @@ export function ensureTemplateParser(
context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>,
): void {
if (
!((context.parserServices as unknown) as ParserServices)
!(context.parserServices as unknown as ParserServices)
?.convertNodeSourceSpanToLoc ||
!((context.parserServices as unknown) as ParserServices)
!(context.parserServices as unknown as ParserServices)
?.convertElementSourceSpanToLoc
) {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ function checkIsInteractiveElement(node: TmplAstElement): boolean {
}
// Check in elementRoles for inherent interactive role associations for
// this element.
const isInherentInteractiveElement = getInteractiveElementRoleSchemas().some(
elementSchemaMatcher,
);
const isInherentInteractiveElement =
getInteractiveElementRoleSchemas().some(elementSchemaMatcher);
if (isInherentInteractiveElement) {
return true;
}
// Check in elementRoles for inherent non-interactive role associations for
// this element.
const isInherentNonInteractiveElement = getNonInteractiveElementRoleSchemas().some(
elementSchemaMatcher,
);
const isInherentNonInteractiveElement =
getNonInteractiveElementRoleSchemas().some(elementSchemaMatcher);
if (isInherentNonInteractiveElement) {
return false;
}
Expand Down
55 changes: 55 additions & 0 deletions packages/eslint-plugin/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"root": "packages/eslint-plugin",
"type": "library",
"targets": {
"build": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["packages/eslint-plugin/dist"],
"options": {
"cwd": "packages/eslint-plugin",
"parallel": false,
"commands": [
"npx rimraf ./dist",
"npx microbundle --tsconfig tsconfig.build.json --no-sourcemap --target=node --compress --format=cjs",
"npx ncp ./src/configs ./dist/configs"
]
}
},
"test": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["packages/eslint-plugin/coverage"],
"options": {
"cwd": "packages/eslint-plugin",
"parallel": false,
"commands": ["npx jest --coverage"]
}
},
"clean": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"cwd": "packages/eslint-plugin",
"parallel": false,
"commands": ["npx rimraf ./dist"]
}
},
"typecheck": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"cwd": "packages/eslint-plugin",
"parallel": false,
"commands": ["npx tsc -p tsconfig.json --noEmit"]
}
},
"check-configs": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"cwd": "packages/eslint-plugin",
"parallel": false,
"commands": [
"npx jest tests/configs.test.ts --runTestsByPath --runInBand"
]
}
}
},
"implicitDependencies": []
}
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ export default {
[noPipeImpureRuleName]: noPipeImpure,
[noQueriesMetadataPropertyRuleName]: noQueriesMetadataProperty,
[noEmptyLifecycleMethodRuleName]: noEmptyLifecycleMethod,
[preferOnPushComponentChangeDetectionRuleName]: preferOnPushComponentChangeDetection,
[preferOnPushComponentChangeDetectionRuleName]:
preferOnPushComponentChangeDetection,
[preferOutputReadonlyRuleName]: preferOutputReadonly,
[relativeUrlPrefixRuleName]: relativeUrlPrefix,
[sortNgmoduleMetadataArraysName]: sortNgmoduleMetadataArrays,
Expand Down
5 changes: 2 additions & 3 deletions packages/eslint-plugin/src/rules/contextual-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ function validateDecorator(
return;
}

const allowedDecorators = ANGULAR_CLASS_DECORATOR_MAPPER.get(
classDecoratorName,
);
const allowedDecorators =
ANGULAR_CLASS_DECORATOR_MAPPER.get(classDecoratorName);

if (allowedDecorators?.has(decoratorName)) {
return;
Expand Down
5 changes: 2 additions & 3 deletions packages/eslint-plugin/src/rules/contextual-lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ export default createESLintRule<Options, MessageIds>({
decorator: AngularClassDecorators,
) {
const classDeclaration = parent as TSESTree.ClassDeclaration;
const allowedMethods = ANGULAR_CLASS_DECORATOR_LIFECYCLE_METHOD_MAPPER.get(
decorator,
);
const allowedMethods =
ANGULAR_CLASS_DECORATOR_LIFECYCLE_METHOD_MAPPER.get(decorator);
const declaredMethods = getDeclaredMethods(classDeclaration);

for (const method of declaredMethods) {
Expand Down
Loading

0 comments on commit 7c47be9

Please sign in to comment.