Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ testem.log
.DS_Store
Thumbs.db

# generated eslint reports
.eslint

# generated Code PushUp reports
/.code-pushup
.code-pushup

# Nx workspace cache
.nx
16 changes: 14 additions & 2 deletions code-pushup.preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import coveragePlugin, {
getNxCoveragePaths,
} from './packages/plugin-coverage/src/index.js';
import eslintPlugin, {
eslintConfigFromAllNxProjects,
eslintConfigFromNxProject,
} from './packages/plugin-eslint/src/index.js';
import type { ESLintTarget } from './packages/plugin-eslint/src/lib/config.js';
import { nxProjectsToConfig } from './packages/plugin-eslint/src/lib/nx/projects-to-config.js';
import jsPackagesPlugin from './packages/plugin-js-packages/src/index.js';
import jsDocsPlugin from './packages/plugin-jsdocs/src/index.js';
import type { JsDocsPluginTransformedConfig } from './packages/plugin-jsdocs/src/lib/config.js';
Expand Down Expand Up @@ -156,14 +157,25 @@ export const jsDocsCoreConfig = (
),
});

export async function eslintConfigFromPublishableNxProjects(): Promise<
ESLintTarget[]
> {
const { createProjectGraphAsync } = await import('@nx/devkit');
const projectGraph = await createProjectGraphAsync({ exitOnError: false });
return nxProjectsToConfig(
projectGraph,
project => project.tags?.includes('publishable') ?? false,
);
}

export const eslintCoreConfigNx = async (
projectName?: string,
): Promise<CoreConfig> => ({
plugins: [
await eslintPlugin(
await (projectName
? eslintConfigFromNxProject(projectName)
: eslintConfigFromAllNxProjects()),
: eslintConfigFromPublishableNxProjects()),
),
],
categories: eslintCategories,
Expand Down
18 changes: 17 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,32 @@
"lint": {
"inputs": ["default", "{workspaceRoot}/eslint.config.?(c)js"],
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"cache": true,
"options": {
"errorOnUnmatchedPattern": false,
"maxWarnings": 0,
"lintFilePatterns": [
"{projectRoot}/**/*.ts",
"{projectRoot}/package.json"
]
}
},
"lint-report": {
"inputs": ["default", "{workspaceRoot}/eslint.config.?(c)js"],
"outputs": ["{projectRoot}/.eslint/eslint-report*.json"],
"cache": true,
"executor": "@nx/linter:eslint",
"options": {
"errorOnUnmatchedPattern": false,
"maxWarnings": 0,
"format": "json",
"outputFile": "{projectRoot}/.eslint/eslint-report.json",
"lintFilePatterns": [
"{projectRoot}/**/*.ts",
"{projectRoot}/package.json"
]
}
},
"nxv-pkg-install": {
"parallelism": false
},
Expand Down
1 change: 1 addition & 0 deletions packages/ci/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"int-test": {}
},
Expand Down
1 change: 1 addition & 0 deletions packages/cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"int-test": {},
"run-help": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"int-test": {}
},
Expand Down
1 change: 1 addition & 0 deletions packages/create-cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"exec-node": {
"dependsOn": ["build"],
Expand Down
1 change: 1 addition & 0 deletions packages/models/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
]
},
"lint": {},
"lint-report": {},
"unit-test": {}
},
"tags": ["scope:shared", "type:util", "publishable"]
Expand Down
9 changes: 9 additions & 0 deletions packages/nx-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
]
}
},
"lint-report": {
"options": {
"lintFilePatterns": [
"packages/nx-plugin/**/*.ts",
"packages/nx-plugin/package.json",
"packages/nx-plugin/generators.json"
]
}
},
"unit-test": {},
"int-test": {}
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-coverage/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"int-test": {}
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-eslint/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"int-test": {}
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-js-packages/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"int-test": {}
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-jsdocs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"int-test": {}
}
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-lighthouse/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {}
},
"tags": ["scope:plugin", "type:feature", "publishable"]
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-typescript/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"unit-test": {},
"int-test": {}
},
Expand Down
1 change: 1 addition & 0 deletions packages/utils/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"targets": {
"build": {},
"lint": {},
"lint-report": {},
"perf": {
"command": "npx tsx --tsconfig=../tsconfig.perf.json",
"options": {
Expand Down
Loading