Skip to content

Commit

Permalink
refactor(nxext): move mapLintPattern to core
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikPieper committed Sep 22, 2023
1 parent 8a8f0d9 commit 1afd04d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nxext/core",
"version": "16.7.0",
"version": "16.8.0",
"description": "Core utilities for nxext Nx plugins",
"author": {
"name": "Gion Kunz",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './lib/utils/add-plugin-to-nx-json';
export * from './lib/utils/ast-utils';
export * from './lib/utils/map-lint-pattern';
8 changes: 8 additions & 0 deletions packages/core/src/lib/utils/map-lint-pattern.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function mapLintPattern(
projectRoot: string,
extension: string,
rootProject?: boolean
) {
const infix = rootProject ? 'src/' : '';
return `${projectRoot}/${infix}**/*.${extension}`;
}
10 changes: 1 addition & 9 deletions packages/nuxt/src/generators/application/lib/add-linting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ensurePackage,
NX_VERSION,
} from '@nx/devkit';
import { mapLintPattern } from '@nxext/core';

export async function addLinting(host: Tree, options: NormalizedSchema) {
const tasks: GeneratorCallback[] = [];
Expand Down Expand Up @@ -55,12 +56,3 @@ export async function addLinting(host: Tree, options: NormalizedSchema) {
}
return runTasksInSerial(...tasks);
}

function mapLintPattern(
projectRoot: string,
extension: string,
rootProject?: boolean
) {
const infix = rootProject ? 'src/' : '';
return `${projectRoot}/${infix}**/*.${extension}`;
}
1 change: 1 addition & 0 deletions packages/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"typings": "./src/index.d.ts",
"schematics": "./generators.json",
"peerDependencies": {
"@nxext/core": "^16.8.0",
"@nx/jest": "^16.8.0",
"@nx/vite": "^16.8.0",
"@nx/js": "^16.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function addLinting(host: Tree, options: NormalizedSchema) {
);
host.delete(joinPathFragments(options.projectRoot, '.eslintrc.json'));

const installTask = await addDependenciesToPackageJson(
const installTask = addDependenciesToPackageJson(
host,
extraEslintDependencies.dependencies,
extraEslintDependencies.devDependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"typescript": "5.1.6",
"@nx/workspace": "^16.8.0",
"nx": "^16.8.0",
"@nxext/core": "^16.7.0"
"@nxext/core": "^16.8.0"
},
"peerDependencies": {
"@nx/js": "^16.8.0",
Expand Down
10 changes: 1 addition & 9 deletions packages/vue/src/generators/application/lib/add-linting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ensurePackage,
NX_VERSION,
} from '@nx/devkit';
import { mapLintPattern } from '@nxext/core';

export async function addLinting(host: Tree, options: NormalizedSchema) {
const tasks: GeneratorCallback[] = [];
Expand Down Expand Up @@ -52,12 +53,3 @@ export async function addLinting(host: Tree, options: NormalizedSchema) {
}
return runTasksInSerial(...tasks);
}

function mapLintPattern(
projectRoot: string,
extension: string,
rootProject?: boolean
) {
const infix = rootProject ? 'src/' : '';
return `${projectRoot}/${infix}**/*.${extension}`;
}

0 comments on commit 1afd04d

Please sign in to comment.