cleanup(linter): deprecate the Linter enum (#30875)
Properly deprecate the `Linter` enum in favor of the `LinterType` union type and remove unneeded internal usages.
This commit is contained in:
parent
8028eea824
commit
f39c1f991e
@ -100,7 +100,7 @@ export async function libraryGenerator(
|
|||||||
directory,
|
directory,
|
||||||
importPath,
|
importPath,
|
||||||
tags: [`type:${options.type}`, `scope:${shared}`],
|
tags: [`type:${options.type}`, `scope:${shared}`],
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
});
|
});
|
||||||
|
|||||||
@ -53,7 +53,7 @@ export async function libraryGenerator(
|
|||||||
) {
|
) {
|
||||||
const callbackAfterFilesUpdated = await reactLibraryGenerator(tree, {
|
const callbackAfterFilesUpdated = await reactLibraryGenerator(tree, {
|
||||||
...options,
|
...options,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
});
|
});
|
||||||
@ -218,7 +218,7 @@ export async function libraryGenerator(
|
|||||||
...options,
|
...options,
|
||||||
tags: `scope:${options.scope}`,
|
tags: `scope:${options.scope}`,
|
||||||
directory: options.directory || `${options.scope}/${options.name}`,
|
directory: options.directory || `${options.scope}/${options.name}`,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
});
|
});
|
||||||
@ -264,7 +264,7 @@ export async function libraryGenerator(
|
|||||||
...options,
|
...options,
|
||||||
tags: `scope:${options.scope}`,
|
tags: `scope:${options.scope}`,
|
||||||
directory,
|
directory,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
})
|
})
|
||||||
|
|||||||
@ -6,8 +6,7 @@ import {
|
|||||||
type Tree,
|
type Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { camelize, dasherize } from '@nx/devkit/src/utils/string-utils';
|
import { camelize, dasherize } from '@nx/devkit/src/utils/string-utils';
|
||||||
import { Linter, lintProjectGenerator } from '@nx/eslint';
|
import { lintProjectGenerator } from '@nx/eslint';
|
||||||
import type * as eslint from 'eslint';
|
|
||||||
import {
|
import {
|
||||||
javaScriptOverride,
|
javaScriptOverride,
|
||||||
typeScriptOverride,
|
typeScriptOverride,
|
||||||
@ -31,7 +30,7 @@ export async function addLintingGenerator(
|
|||||||
const tasks: GeneratorCallback[] = [];
|
const tasks: GeneratorCallback[] = [];
|
||||||
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
|
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
|
||||||
const lintTask = await lintProjectGenerator(tree, {
|
const lintTask = await lintProjectGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: options.projectName,
|
project: options.projectName,
|
||||||
tsConfigPaths: [
|
tsConfigPaths: [
|
||||||
joinPathFragments(options.projectRoot, 'tsconfig.app.json'),
|
joinPathFragments(options.projectRoot, 'tsconfig.app.json'),
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import {
|
|||||||
updateProjectConfiguration,
|
updateProjectConfiguration,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import * as enquirer from 'enquirer';
|
import * as enquirer from 'enquirer';
|
||||||
import { backwardCompatibleVersions } from '../../utils/backward-compatible-versions';
|
import { backwardCompatibleVersions } from '../../utils/backward-compatible-versions';
|
||||||
import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
||||||
@ -573,7 +572,7 @@ describe('app', () => {
|
|||||||
describe('--linter', () => {
|
describe('--linter', () => {
|
||||||
describe('eslint', () => {
|
describe('eslint', () => {
|
||||||
it('should add lint target to application', async () => {
|
it('should add lint target to application', async () => {
|
||||||
await generateApp(appTree, 'my-app', { linter: Linter.EsLint });
|
await generateApp(appTree, 'my-app', { linter: 'eslint' });
|
||||||
expect(readProjectConfiguration(appTree, 'my-app').targets.lint)
|
expect(readProjectConfiguration(appTree, 'my-app').targets.lint)
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
@ -583,7 +582,7 @@ describe('app', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should add eslint plugin and no lint target to e2e project', async () => {
|
it('should add eslint plugin and no lint target to e2e project', async () => {
|
||||||
await generateApp(appTree, 'my-app', { linter: Linter.EsLint });
|
await generateApp(appTree, 'my-app', { linter: 'eslint' });
|
||||||
|
|
||||||
const nxJson = readNxJson(appTree);
|
const nxJson = readNxJson(appTree);
|
||||||
expect(nxJson.plugins).toMatchInlineSnapshot(`
|
expect(nxJson.plugins).toMatchInlineSnapshot(`
|
||||||
@ -612,7 +611,7 @@ describe('app', () => {
|
|||||||
|
|
||||||
it('should not add eslint plugin when no e2e test runner', async () => {
|
it('should not add eslint plugin when no e2e test runner', async () => {
|
||||||
await generateApp(appTree, 'my-app', {
|
await generateApp(appTree, 'my-app', {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: E2eTestRunner.None,
|
e2eTestRunner: E2eTestRunner.None,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -620,7 +619,7 @@ describe('app', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should add valid eslint JSON configuration which extends from Nx presets', async () => {
|
it('should add valid eslint JSON configuration which extends from Nx presets', async () => {
|
||||||
await generateApp(appTree, 'my-app', { linter: Linter.EsLint });
|
await generateApp(appTree, 'my-app', { linter: 'eslint' });
|
||||||
|
|
||||||
const eslintConfig = readJson(appTree, 'my-app/.eslintrc.json');
|
const eslintConfig = readJson(appTree, 'my-app/.eslintrc.json');
|
||||||
expect(eslintConfig).toMatchInlineSnapshot(`
|
expect(eslintConfig).toMatchInlineSnapshot(`
|
||||||
@ -676,7 +675,7 @@ describe('app', () => {
|
|||||||
|
|
||||||
describe('none', () => {
|
describe('none', () => {
|
||||||
it('should add no lint target', async () => {
|
it('should add no lint target', async () => {
|
||||||
await generateApp(appTree, 'my-app', { linter: Linter.None });
|
await generateApp(appTree, 'my-app', { linter: 'none' });
|
||||||
expect(
|
expect(
|
||||||
readProjectConfiguration(appTree, 'my-app').targets.lint
|
readProjectConfiguration(appTree, 'my-app').targets.lint
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
@ -1426,7 +1425,7 @@ async function generateApp(
|
|||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
e2eTestRunner: E2eTestRunner.Cypress,
|
e2eTestRunner: E2eTestRunner.Cypress,
|
||||||
unitTestRunner: UnitTestRunner.Jest,
|
unitTestRunner: UnitTestRunner.Jest,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
standalone: false,
|
standalone: false,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
import type { Tree } from '@nx/devkit';
|
import type { Tree } from '@nx/devkit';
|
||||||
import type { NormalizedSchema } from './normalized-schema';
|
import type { NormalizedSchema } from './normalized-schema';
|
||||||
|
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import addLintingGenerator from '../../add-linting/add-linting';
|
import addLintingGenerator from '../../add-linting/add-linting';
|
||||||
|
|
||||||
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
||||||
if (options.linter === Linter.None) {
|
if (options.linter === 'none') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await addLintingGenerator(host, {
|
await addLintingGenerator(host, {
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import {
|
|||||||
determineProjectNameAndRootOptions,
|
determineProjectNameAndRootOptions,
|
||||||
ensureRootProjectName,
|
ensureRootProjectName,
|
||||||
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { E2eTestRunner, UnitTestRunner } from '../../../utils/test-runners';
|
import { E2eTestRunner, UnitTestRunner } from '../../../utils/test-runners';
|
||||||
import type { Schema } from '../schema';
|
import type { Schema } from '../schema';
|
||||||
import type { NormalizedSchema } from './normalized-schema';
|
import type { NormalizedSchema } from './normalized-schema';
|
||||||
@ -51,7 +50,7 @@ export async function normalizeOptions(
|
|||||||
skipTests: options.unitTestRunner === UnitTestRunner.None,
|
skipTests: options.unitTestRunner === UnitTestRunner.None,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
e2eTestRunner: E2eTestRunner.Playwright,
|
e2eTestRunner: E2eTestRunner.Playwright,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
strict: true,
|
strict: true,
|
||||||
standalone: true,
|
standalone: true,
|
||||||
directory: appProjectRoot,
|
directory: appProjectRoot,
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
import { assertMinimumCypressVersion } from '@nx/cypress/src/utils/versions';
|
import { assertMinimumCypressVersion } from '@nx/cypress/src/utils/versions';
|
||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { UnitTestRunner } from '../../utils/test-runners';
|
import { UnitTestRunner } from '../../utils/test-runners';
|
||||||
import { componentGenerator } from '../component/component';
|
import { componentGenerator } from '../component/component';
|
||||||
import { generateTestLibrary } from '../utils/testing';
|
import { generateTestLibrary } from '../utils/testing';
|
||||||
@ -28,7 +27,7 @@ describe('Angular Cypress Component Test Generator', () => {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
unitTestRunner: UnitTestRunner.None,
|
unitTestRunner: UnitTestRunner.None,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
});
|
});
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
@ -52,7 +51,7 @@ describe('Angular Cypress Component Test Generator', () => {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
unitTestRunner: UnitTestRunner.None,
|
unitTestRunner: UnitTestRunner.None,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
});
|
});
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
@ -106,7 +105,7 @@ export class MyLibComponent implements OnInit {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
unitTestRunner: UnitTestRunner.None,
|
unitTestRunner: UnitTestRunner.None,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
});
|
});
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
@ -159,7 +158,7 @@ export class MyLibComponent implements OnInit {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
unitTestRunner: UnitTestRunner.None,
|
unitTestRunner: UnitTestRunner.None,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -190,7 +189,7 @@ export class MyLibComponent implements OnInit {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
unitTestRunner: UnitTestRunner.None,
|
unitTestRunner: UnitTestRunner.None,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { Schema } from './schema';
|
|||||||
import { Schema as remoteSchma } from '../remote/schema';
|
import { Schema as remoteSchma } from '../remote/schema';
|
||||||
import { federateModuleGenerator } from './federate-module';
|
import { federateModuleGenerator } from './federate-module';
|
||||||
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports';
|
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import remoteGenerator from '../remote/remote';
|
import remoteGenerator from '../remote/remote';
|
||||||
import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ describe('federate-module', () => {
|
|||||||
directory: 'myremote',
|
directory: 'myremote',
|
||||||
e2eTestRunner: E2eTestRunner.Cypress,
|
e2eTestRunner: E2eTestRunner.Cypress,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: UnitTestRunner.Jest,
|
unitTestRunner: UnitTestRunner.Jest,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import {
|
|||||||
generateTestHostApplication,
|
generateTestHostApplication,
|
||||||
generateTestRemoteApplication,
|
generateTestRemoteApplication,
|
||||||
} from '../utils/testing';
|
} from '../utils/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
describe('Host App Generator', () => {
|
describe('Host App Generator', () => {
|
||||||
it('should generate a host app with no remotes', async () => {
|
it('should generate a host app with no remotes', async () => {
|
||||||
@ -550,7 +549,7 @@ describe('Host App Generator', () => {
|
|||||||
remotes: [remote],
|
remotes: [remote],
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
e2eTestRunner: E2eTestRunner.None,
|
e2eTestRunner: E2eTestRunner.None,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: UnitTestRunner.None,
|
unitTestRunner: UnitTestRunner.None,
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import {
|
|||||||
determineProjectNameAndRootOptions,
|
determineProjectNameAndRootOptions,
|
||||||
ensureRootProjectName,
|
ensureRootProjectName,
|
||||||
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { UnitTestRunner } from '../../../utils/test-runners';
|
import { UnitTestRunner } from '../../../utils/test-runners';
|
||||||
import { Schema } from '../schema';
|
import { Schema } from '../schema';
|
||||||
import { NormalizedSchema } from './normalized-schema';
|
import { NormalizedSchema } from './normalized-schema';
|
||||||
@ -16,7 +15,7 @@ export async function normalizeOptions(
|
|||||||
// Create a schema with populated default values
|
// Create a schema with populated default values
|
||||||
const options: Schema = {
|
const options: Schema = {
|
||||||
buildable: false,
|
buildable: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
publishable: false,
|
publishable: false,
|
||||||
simpleName: false,
|
simpleName: false,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
@ -55,7 +54,7 @@ export async function normalizeOptions(
|
|||||||
const ngCliSchematicLibRoot = projectName;
|
const ngCliSchematicLibRoot = projectName;
|
||||||
const allNormalizedOptions = {
|
const allNormalizedOptions = {
|
||||||
...options,
|
...options,
|
||||||
linter: options.linter ?? Linter.EsLint,
|
linter: options.linter ?? 'eslint',
|
||||||
unitTestRunner: options.unitTestRunner ?? UnitTestRunner.Jest,
|
unitTestRunner: options.unitTestRunner ?? UnitTestRunner.Jest,
|
||||||
prefix: options.prefix ?? 'lib',
|
prefix: options.prefix ?? 'lib',
|
||||||
name: projectName,
|
name: projectName,
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import {
|
|||||||
updateJson,
|
updateJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { createApp } from '../../utils/nx-devkit/testing';
|
import { createApp } from '../../utils/nx-devkit/testing';
|
||||||
import { UnitTestRunner } from '../../utils/test-runners';
|
import { UnitTestRunner } from '../../utils/test-runners';
|
||||||
import {
|
import {
|
||||||
@ -40,7 +39,7 @@ describe('lib', () => {
|
|||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
publishable: false,
|
publishable: false,
|
||||||
buildable: false,
|
buildable: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
unitTestRunner: UnitTestRunner.Jest,
|
unitTestRunner: UnitTestRunner.Jest,
|
||||||
simpleName: false,
|
simpleName: false,
|
||||||
@ -1205,7 +1204,7 @@ describe('lib', () => {
|
|||||||
it('should add valid eslint JSON configuration which extends from Nx presets (flat config)', async () => {
|
it('should add valid eslint JSON configuration which extends from Nx presets (flat config)', async () => {
|
||||||
tree.write('eslint.config.cjs', '');
|
tree.write('eslint.config.cjs', '');
|
||||||
|
|
||||||
await runLibraryGeneratorWithOpts({ linter: Linter.EsLint });
|
await runLibraryGeneratorWithOpts({ linter: 'eslint' });
|
||||||
|
|
||||||
const eslintConfig = tree.read('my-lib/eslint.config.cjs', 'utf-8');
|
const eslintConfig = tree.read('my-lib/eslint.config.cjs', 'utf-8');
|
||||||
expect(eslintConfig).toMatchInlineSnapshot(`
|
expect(eslintConfig).toMatchInlineSnapshot(`
|
||||||
@ -1253,7 +1252,7 @@ describe('lib', () => {
|
|||||||
|
|
||||||
it('should add valid eslint JSON configuration which extends from Nx presets (eslintrc)', async () => {
|
it('should add valid eslint JSON configuration which extends from Nx presets (eslintrc)', async () => {
|
||||||
// ACT
|
// ACT
|
||||||
await runLibraryGeneratorWithOpts({ linter: Linter.EsLint });
|
await runLibraryGeneratorWithOpts({ linter: 'eslint' });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
|
|
||||||
@ -1311,7 +1310,7 @@ describe('lib', () => {
|
|||||||
it('should add dependency checks to buildable libs', async () => {
|
it('should add dependency checks to buildable libs', async () => {
|
||||||
// ACT
|
// ACT
|
||||||
await runLibraryGeneratorWithOpts({
|
await runLibraryGeneratorWithOpts({
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
buildable: true,
|
buildable: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1388,7 +1387,7 @@ describe('lib', () => {
|
|||||||
describe('none', () => {
|
describe('none', () => {
|
||||||
it('should not add an architect target for lint', async () => {
|
it('should not add an architect target for lint', async () => {
|
||||||
// ACT
|
// ACT
|
||||||
await runLibraryGeneratorWithOpts({ linter: Linter.None });
|
await runLibraryGeneratorWithOpts({ linter: 'none' });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import {
|
|||||||
joinPathFragments,
|
joinPathFragments,
|
||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { addTsConfigPath, initGenerator as jsInitGenerator } from '@nx/js';
|
import { addTsConfigPath, initGenerator as jsInitGenerator } from '@nx/js';
|
||||||
import init from '../../generators/init/init';
|
import init from '../../generators/init/init';
|
||||||
import addLintingGenerator from '../add-linting/add-linting';
|
import addLintingGenerator from '../add-linting/add-linting';
|
||||||
@ -180,7 +179,7 @@ async function addLinting(
|
|||||||
host: Tree,
|
host: Tree,
|
||||||
options: NormalizedSchema['libraryOptions']
|
options: NormalizedSchema['libraryOptions']
|
||||||
) {
|
) {
|
||||||
if (options.linter === Linter.None) {
|
if (options.linter === 'none') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await addLintingGenerator(host, {
|
await addLintingGenerator(host, {
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
import * as devkit from '@nx/devkit';
|
import * as devkit from '@nx/devkit';
|
||||||
import { ProjectGraph, readJson, Tree } from '@nx/devkit';
|
import { ProjectGraph, readJson, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { UnitTestRunner } from '../../utils/test-runners';
|
import { UnitTestRunner } from '../../utils/test-runners';
|
||||||
import { librarySecondaryEntryPointGenerator } from '../library-secondary-entry-point/library-secondary-entry-point';
|
import { librarySecondaryEntryPointGenerator } from '../library-secondary-entry-point/library-secondary-entry-point';
|
||||||
import { generateTestLibrary } from '../utils/testing';
|
import { generateTestLibrary } from '../utils/testing';
|
||||||
@ -36,7 +35,7 @@ describe('@nx/angular:move', () => {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
buildable: false,
|
buildable: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
publishable: false,
|
publishable: false,
|
||||||
simpleName: true,
|
simpleName: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -132,7 +131,7 @@ describe('@nx/angular:move', () => {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-lib2',
|
directory: 'my-lib2',
|
||||||
buildable: false,
|
buildable: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
publishable: false,
|
publishable: false,
|
||||||
simpleName: true,
|
simpleName: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -259,7 +258,7 @@ describe('@nx/angular:move', () => {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-importer',
|
directory: 'my-importer',
|
||||||
buildable: false,
|
buildable: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
publishable: false,
|
publishable: false,
|
||||||
simpleName: true,
|
simpleName: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -342,7 +341,7 @@ describe('@nx/angular:move', () => {
|
|||||||
await generateTestLibrary(tree, {
|
await generateTestLibrary(tree, {
|
||||||
directory: 'my-lib-demo',
|
directory: 'my-lib-demo',
|
||||||
buildable: false,
|
buildable: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
publishable: false,
|
publishable: false,
|
||||||
simpleName: true,
|
simpleName: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import {
|
|||||||
updateProjectConfiguration,
|
updateProjectConfiguration,
|
||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { Linter, lintProjectGenerator } from '@nx/eslint';
|
import { lintProjectGenerator } from '@nx/eslint';
|
||||||
import { getRootTsConfigPathInTree, insertImport } from '@nx/js';
|
import { getRootTsConfigPathInTree, insertImport } from '@nx/js';
|
||||||
import { ensureTypescript } from '@nx/js/src/utils/typescript/ensure-typescript';
|
import { ensureTypescript } from '@nx/js/src/utils/typescript/ensure-typescript';
|
||||||
import { basename, relative } from 'path';
|
import { basename, relative } from 'path';
|
||||||
@ -317,7 +317,7 @@ export class E2eMigrator extends ProjectMigrator<SupportedTargets> {
|
|||||||
if (this.isProjectUsingEsLint) {
|
if (this.isProjectUsingEsLint) {
|
||||||
await lintProjectGenerator(this.tree, {
|
await lintProjectGenerator(this.tree, {
|
||||||
project: this.project.name,
|
project: this.project.name,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
unitTestRunner: this.options.unitTestRunner,
|
unitTestRunner: this.options.unitTestRunner,
|
||||||
tsConfigPaths: [
|
tsConfigPaths: [
|
||||||
joinPathFragments(this.project.newRoot, 'tsconfig.json'),
|
joinPathFragments(this.project.newRoot, 'tsconfig.json'),
|
||||||
@ -347,7 +347,7 @@ export class E2eMigrator extends ProjectMigrator<SupportedTargets> {
|
|||||||
);
|
);
|
||||||
await configurationGenerator(this.tree, {
|
await configurationGenerator(this.tree, {
|
||||||
project: this.project.name,
|
project: this.project.name,
|
||||||
linter: this.isProjectUsingEsLint ? Linter.EsLint : Linter.None,
|
linter: this.isProjectUsingEsLint ? 'eslint' : 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
// any target would do, we replace it later with the target existing in the project being migrated
|
// any target would do, we replace it later with the target existing in the project being migrated
|
||||||
devServerTarget: `${this.appName}:serve`,
|
devServerTarget: `${this.appName}:serve`,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import type { Tree } from '@nx/devkit';
|
import type { Tree } from '@nx/devkit';
|
||||||
import { readJson, writeJson } from '@nx/devkit';
|
import { readJson, writeJson } from '@nx/devkit';
|
||||||
import { Linter } from '@nx/eslint/src/generators/utils/linter';
|
|
||||||
import { componentGenerator } from '../component/component';
|
import { componentGenerator } from '../component/component';
|
||||||
import { librarySecondaryEntryPointGenerator } from '../library-secondary-entry-point/library-secondary-entry-point';
|
import { librarySecondaryEntryPointGenerator } from '../library-secondary-entry-point/library-secondary-entry-point';
|
||||||
import {
|
import {
|
||||||
@ -64,7 +63,7 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
await storybookConfigurationGenerator(tree, {
|
await storybookConfigurationGenerator(tree, {
|
||||||
project: libName,
|
project: libName,
|
||||||
generateStories: false,
|
generateStories: false,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -192,7 +191,7 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
project: 'test-app',
|
project: 'test-app',
|
||||||
generateStories: false,
|
generateStories: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
|
|
||||||
const tsConfig = readJson(tree, 'test-app/tsconfig.editor.json');
|
const tsConfig = readJson(tree, 'test-app/tsconfig.editor.json');
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import type { Tree } from '@nx/devkit';
|
import type { Tree } from '@nx/devkit';
|
||||||
import { names, readProjectConfiguration } from '@nx/devkit';
|
import { names, readProjectConfiguration } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { UnitTestRunner } from '../../utils/test-runners';
|
import { UnitTestRunner } from '../../utils/test-runners';
|
||||||
import { applicationGenerator } from '../application/application';
|
import { applicationGenerator } from '../application/application';
|
||||||
import type { Schema as ApplicationOptions } from '../application/schema';
|
import type { Schema as ApplicationOptions } from '../application/schema';
|
||||||
@ -58,7 +57,7 @@ export async function createStorybookTestWorkspaceForLib(
|
|||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: libName,
|
directory: libName,
|
||||||
buildable: false,
|
buildable: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
publishable: false,
|
publishable: false,
|
||||||
simpleName: false,
|
simpleName: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export async function addLinterToCyProject(
|
|||||||
tree: Tree,
|
tree: Tree,
|
||||||
options: CyLinterOptions
|
options: CyLinterOptions
|
||||||
) {
|
) {
|
||||||
if (options.linter === Linter.None) {
|
if (options.linter === 'none') {
|
||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ export async function addLinterToCyProject(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options.linter || options.linter !== Linter.EsLint) {
|
if (!options.linter || options.linter !== 'eslint') {
|
||||||
return runTasksInSerial(...tasks);
|
return runTasksInSerial(...tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint/src/generators/utils/linter';
|
|
||||||
|
|
||||||
import detoxApplicationGenerator from './application';
|
import detoxApplicationGenerator from './application';
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ describe('detox application generator', () => {
|
|||||||
await detoxApplicationGenerator(tree, {
|
await detoxApplicationGenerator(tree, {
|
||||||
e2eDirectory: 'my-app-e2e',
|
e2eDirectory: 'my-app-e2e',
|
||||||
appProject: 'my-app',
|
appProject: 'my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
@ -101,7 +100,7 @@ describe('detox application generator', () => {
|
|||||||
e2eName: 'my-app-e2e',
|
e2eName: 'my-app-e2e',
|
||||||
e2eDirectory: 'my-dir',
|
e2eDirectory: 'my-dir',
|
||||||
appProject: 'my-dir-my-app',
|
appProject: 'my-dir-my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
@ -172,7 +171,7 @@ describe('detox application generator', () => {
|
|||||||
e2eName: 'my-app-e2e',
|
e2eName: 'my-app-e2e',
|
||||||
e2eDirectory: 'e2e-dir',
|
e2eDirectory: 'e2e-dir',
|
||||||
appProject: 'my-dir-my-app',
|
appProject: 'my-dir-my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
@ -242,7 +241,7 @@ describe('detox application generator', () => {
|
|||||||
await detoxApplicationGenerator(tree, {
|
await detoxApplicationGenerator(tree, {
|
||||||
e2eDirectory: 'my-dir/my-app-e2e',
|
e2eDirectory: 'my-dir/my-app-e2e',
|
||||||
appProject: 'my-dir-my-app',
|
appProject: 'my-dir-my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
@ -334,7 +333,7 @@ describe('detox application generator', () => {
|
|||||||
await detoxApplicationGenerator(tree, {
|
await detoxApplicationGenerator(tree, {
|
||||||
e2eDirectory: 'my-dir/my-app-e2e',
|
e2eDirectory: 'my-dir/my-app-e2e',
|
||||||
appProject: 'my-dir-my-app',
|
appProject: 'my-dir-my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'expo',
|
framework: 'expo',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
@ -416,7 +415,7 @@ describe('detox application generator', () => {
|
|||||||
await detoxApplicationGenerator(tree, {
|
await detoxApplicationGenerator(tree, {
|
||||||
e2eDirectory: 'my-app-e2e',
|
e2eDirectory: 'my-app-e2e',
|
||||||
appProject: 'my-app',
|
appProject: 'my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
@ -461,7 +460,7 @@ describe('detox application generator', () => {
|
|||||||
await detoxApplicationGenerator(tree, {
|
await detoxApplicationGenerator(tree, {
|
||||||
e2eDirectory: 'my-app-e2e',
|
e2eDirectory: 'my-app-e2e',
|
||||||
appProject: 'my-app',
|
appProject: 'my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
@ -528,7 +527,7 @@ describe('detox application generator', () => {
|
|||||||
await detoxApplicationGenerator(tree, {
|
await detoxApplicationGenerator(tree, {
|
||||||
e2eDirectory: 'apps/my-app-e2e',
|
e2eDirectory: 'apps/my-app-e2e',
|
||||||
appProject: 'my-app',
|
appProject: 'my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
useProjectJson: false,
|
useProjectJson: false,
|
||||||
@ -589,7 +588,7 @@ describe('detox application generator', () => {
|
|||||||
await detoxApplicationGenerator(tree, {
|
await detoxApplicationGenerator(tree, {
|
||||||
e2eDirectory: 'apps/my-app-e2e',
|
e2eDirectory: 'apps/my-app-e2e',
|
||||||
appProject: 'my-app',
|
appProject: 'my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -670,7 +669,7 @@ describe('detox application generator', () => {
|
|||||||
e2eDirectory: 'apps/my-app-e2e',
|
e2eDirectory: 'apps/my-app-e2e',
|
||||||
appProject: 'my-app',
|
appProject: 'my-app',
|
||||||
e2eName: 'my-app-e2e',
|
e2eName: 'my-app-e2e',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -698,7 +697,7 @@ describe('detox application generator', () => {
|
|||||||
e2eDirectory: 'apps/my-app-e2e',
|
e2eDirectory: 'apps/my-app-e2e',
|
||||||
appProject: 'my-app',
|
appProject: 'my-app',
|
||||||
e2eName: 'my-app-e2e',
|
e2eName: 'my-app-e2e',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { readProjectConfiguration, Tree } from '@nx/devkit';
|
import { readProjectConfiguration, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { addLinting } from './add-linting';
|
import { addLinting } from './add-linting';
|
||||||
import { addProject } from './add-project';
|
import { addProject } from './add-project';
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ describe('Add Linting', () => {
|
|||||||
appDisplayName: 'MyApp',
|
appDisplayName: 'MyApp',
|
||||||
appExpoName: 'MyApp',
|
appExpoName: 'MyApp',
|
||||||
appRoot: 'apps/my-app',
|
appRoot: 'apps/my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
isUsingTsSolutionConfig: false,
|
isUsingTsSolutionConfig: false,
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
});
|
});
|
||||||
@ -38,7 +37,7 @@ describe('Add Linting', () => {
|
|||||||
appDisplayName: 'MyApp',
|
appDisplayName: 'MyApp',
|
||||||
appExpoName: 'MyApp',
|
appExpoName: 'MyApp',
|
||||||
appRoot: 'apps/my-app',
|
appRoot: 'apps/my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
isUsingTsSolutionConfig: false,
|
isUsingTsSolutionConfig: false,
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
});
|
});
|
||||||
@ -58,7 +57,7 @@ describe('Add Linting', () => {
|
|||||||
appDisplayName: 'MyApp',
|
appDisplayName: 'MyApp',
|
||||||
appExpoName: 'MyApp',
|
appExpoName: 'MyApp',
|
||||||
appRoot: 'apps/my-app',
|
appRoot: 'apps/my-app',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
isUsingTsSolutionConfig: false,
|
isUsingTsSolutionConfig: false,
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Linter, lintProjectGenerator } from '@nx/eslint';
|
import { lintProjectGenerator } from '@nx/eslint';
|
||||||
import {
|
import {
|
||||||
addDependenciesToPackageJson,
|
addDependenciesToPackageJson,
|
||||||
GeneratorCallback,
|
GeneratorCallback,
|
||||||
@ -17,7 +17,7 @@ import {
|
|||||||
import { useFlatConfig } from '@nx/eslint/src/utils/flat-config';
|
import { useFlatConfig } from '@nx/eslint/src/utils/flat-config';
|
||||||
|
|
||||||
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
||||||
if (options.linter === Linter.None) {
|
if (options.linter === 'none') {
|
||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import {
|
|||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { addProject } from './add-project';
|
import { addProject } from './add-project';
|
||||||
|
|
||||||
describe('Add Project', () => {
|
describe('Add Project', () => {
|
||||||
@ -39,7 +38,7 @@ describe('Add Project', () => {
|
|||||||
appDisplayName: 'MyApp',
|
appDisplayName: 'MyApp',
|
||||||
appExpoName: 'MyApp',
|
appExpoName: 'MyApp',
|
||||||
appRoot: 'apps/my-app',
|
appRoot: 'apps/my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
useProjectJson: true,
|
useProjectJson: true,
|
||||||
});
|
});
|
||||||
@ -90,7 +89,7 @@ describe('Add Project', () => {
|
|||||||
appDisplayName: 'MyApp',
|
appDisplayName: 'MyApp',
|
||||||
appExpoName: 'MyApp',
|
appExpoName: 'MyApp',
|
||||||
appRoot: 'apps/my-dir/my-app',
|
appRoot: 'apps/my-dir/my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
useProjectJson: true,
|
useProjectJson: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { createFiles } from './create-files';
|
import { createFiles } from './create-files';
|
||||||
|
|
||||||
describe('Create Files', () => {
|
describe('Create Files', () => {
|
||||||
@ -22,7 +21,7 @@ describe('Create Files', () => {
|
|||||||
appDisplayName: 'MyApp',
|
appDisplayName: 'MyApp',
|
||||||
appExpoName: 'MyApp',
|
appExpoName: 'MyApp',
|
||||||
appRoot: 'apps/my-app',
|
appRoot: 'apps/my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { addProjectConfiguration, Tree } from '@nx/devkit';
|
import { addProjectConfiguration, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
import { Schema } from '../schema';
|
import { Schema } from '../schema';
|
||||||
import { normalizeOptions } from './normalize-options';
|
import { normalizeOptions } from './normalize-options';
|
||||||
@ -21,7 +20,7 @@ describe('Normalize Options', () => {
|
|||||||
framework: 'react-native',
|
framework: 'react-native',
|
||||||
e2eDirectory: 'apps/my-app-e2e',
|
e2eDirectory: 'apps/my-app-e2e',
|
||||||
appProject: 'my-app',
|
appProject: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
};
|
};
|
||||||
const options = await normalizeOptions(appTree, schema);
|
const options = await normalizeOptions(appTree, schema);
|
||||||
expect(options).toEqual({
|
expect(options).toEqual({
|
||||||
@ -38,7 +37,7 @@ describe('Normalize Options', () => {
|
|||||||
appExpoName: 'MyApp',
|
appExpoName: 'MyApp',
|
||||||
appRoot: 'apps/my-app',
|
appRoot: 'apps/my-app',
|
||||||
isUsingTsSolutionConfig: false,
|
isUsingTsSolutionConfig: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
js: false,
|
js: false,
|
||||||
useProjectJson: true,
|
useProjectJson: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import {
|
|||||||
import { convertToFlatConfigGenerator } from './generator';
|
import { convertToFlatConfigGenerator } from './generator';
|
||||||
import { ConvertToFlatConfigGeneratorSchema } from './schema';
|
import { ConvertToFlatConfigGeneratorSchema } from './schema';
|
||||||
import { lintProjectGenerator } from '../lint-project/lint-project';
|
import { lintProjectGenerator } from '../lint-project/lint-project';
|
||||||
import { Linter } from '../utils/linter';
|
|
||||||
import { eslintrcVersion } from '../../utils/versions';
|
import { eslintrcVersion } from '../../utils/versions';
|
||||||
import { dump } from '@zkochan/js-yaml';
|
import { dump } from '@zkochan/js-yaml';
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should update dependencies', async () => {
|
it('should update dependencies', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
@ -80,7 +79,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert json successfully', async () => {
|
it('should convert json successfully', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -106,7 +105,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert yaml successfully', async () => {
|
it('should convert yaml successfully', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
eslintFilePatterns: ['**/*.ts'],
|
eslintFilePatterns: ['**/*.ts'],
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
@ -137,7 +136,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert yml successfully', async () => {
|
it('should convert yml successfully', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
eslintFilePatterns: ['**/*.ts'],
|
eslintFilePatterns: ['**/*.ts'],
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
@ -168,7 +167,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add plugin extends', async () => {
|
it('should add plugin extends', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -273,7 +272,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add global eslintignores', async () => {
|
it('should add global eslintignores', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
@ -289,7 +288,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should handle custom eslintignores', async () => {
|
it('should handle custom eslintignores', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -319,7 +318,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add settings', async () => {
|
it('should add settings', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -338,7 +337,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add env configuration', async () => {
|
it('should add env configuration', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -358,7 +357,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add global configuration', async () => {
|
it('should add global configuration', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -377,7 +376,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add global and env configuration', async () => {
|
it('should add global and env configuration', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -399,7 +398,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add plugins', async () => {
|
it('should add plugins', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -421,7 +420,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add parser', async () => {
|
it('should add parser', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -438,7 +437,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add linter options', async () => {
|
it('should add linter options', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -517,7 +516,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert project if target is defined via plugin as string', async () => {
|
it('should convert project if target is defined via plugin as string', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -546,7 +545,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert project if target is defined via plugin as object', async () => {
|
it('should convert project if target is defined via plugin as object', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'cjs',
|
eslintConfigFormat: 'cjs',
|
||||||
@ -586,7 +585,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
});
|
});
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
|
|
||||||
project: 'dx-assets-ui',
|
project: 'dx-assets-ui',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
@ -666,7 +665,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should update dependencies', async () => {
|
it('should update dependencies', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -693,7 +692,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert json successfully', async () => {
|
it('should convert json successfully', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -719,7 +718,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert yaml successfully', async () => {
|
it('should convert yaml successfully', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
eslintFilePatterns: ['**/*.ts'],
|
eslintFilePatterns: ['**/*.ts'],
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
@ -750,7 +749,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert yml successfully', async () => {
|
it('should convert yml successfully', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
eslintFilePatterns: ['**/*.ts'],
|
eslintFilePatterns: ['**/*.ts'],
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
@ -781,7 +780,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add plugin extends', async () => {
|
it('should add plugin extends', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -888,7 +887,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add global eslintignores', async () => {
|
it('should add global eslintignores', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
@ -904,7 +903,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should handle custom eslintignores', async () => {
|
it('should handle custom eslintignores', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -934,7 +933,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add settings', async () => {
|
it('should add settings', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -953,7 +952,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add env configuration', async () => {
|
it('should add env configuration', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -973,7 +972,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add global configuration', async () => {
|
it('should add global configuration', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -992,7 +991,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add global and env configuration', async () => {
|
it('should add global and env configuration', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -1014,7 +1013,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add plugins', async () => {
|
it('should add plugins', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -1036,7 +1035,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add parser', async () => {
|
it('should add parser', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -1053,7 +1052,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should add linter options', async () => {
|
it('should add linter options', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -1134,7 +1133,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert project if target is defined via plugin as string', async () => {
|
it('should convert project if target is defined via plugin as string', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -1163,7 +1162,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
it('should convert project if target is defined via plugin as object', async () => {
|
it('should convert project if target is defined via plugin as object', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintConfigFormat: 'mjs',
|
eslintConfigFormat: 'mjs',
|
||||||
@ -1203,7 +1202,7 @@ describe('convert-to-flat-config generator', () => {
|
|||||||
});
|
});
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
|
|
||||||
project: 'dx-assets-ui',
|
project: 'dx-assets-ui',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import {
|
|||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
|
|
||||||
import { Linter } from '../utils/linter';
|
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { lintProjectGenerator } from './lint-project';
|
import { lintProjectGenerator } from './lint-project';
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ describe('@nx/eslint:lint-project (convert to monorepo style)', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'nestedpkg',
|
project: 'nestedpkg',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import {
|
|||||||
updateJson,
|
updateJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
|
|
||||||
import { Linter } from '../utils/linter';
|
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { lintProjectGenerator } from './lint-project';
|
import { lintProjectGenerator } from './lint-project';
|
||||||
|
|
||||||
@ -52,7 +51,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -80,7 +79,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -108,7 +107,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -137,7 +136,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -167,7 +166,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -195,7 +194,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -223,7 +222,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -252,7 +251,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -277,7 +276,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
process.env.ESLINT_USE_FLAT_CONFIG = 'true';
|
process.env.ESLINT_USE_FLAT_CONFIG = 'true';
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -348,7 +347,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
process.env.ESLINT_USE_FLAT_CONFIG = 'true';
|
process.env.ESLINT_USE_FLAT_CONFIG = 'true';
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -417,7 +416,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
it('should generate a eslint config (legacy)', async () => {
|
it('should generate a eslint config (legacy)', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
@ -449,7 +448,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
it('should generate a project config with lintFilePatterns if provided', async () => {
|
it('should generate a project config with lintFilePatterns if provided', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
eslintFilePatterns: ['libs/test-lib/src/**/*.ts'],
|
eslintFilePatterns: ['libs/test-lib/src/**/*.ts'],
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
@ -466,7 +465,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
it('should generate a eslint config for buildable library', async () => {
|
it('should generate a eslint config for buildable library', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'buildable-lib',
|
project: 'buildable-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
@ -513,7 +512,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
it('should generate a project config for buildable lib with lintFilePatterns if provided', async () => {
|
it('should generate a project config for buildable lib with lintFilePatterns if provided', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'buildable-lib',
|
project: 'buildable-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
eslintFilePatterns: ['libs/test-lib/src/**/*.ts'],
|
eslintFilePatterns: ['libs/test-lib/src/**/*.ts'],
|
||||||
@ -532,7 +531,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
@ -570,7 +569,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'buildable-lib',
|
project: 'buildable-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
@ -593,7 +592,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'buildable-lib',
|
project: 'buildable-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
});
|
});
|
||||||
@ -606,7 +605,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
it('should extend root config', async () => {
|
it('should extend root config', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
eslintFilePatterns: ['libs/test-lib/**/*.ts'],
|
eslintFilePatterns: ['libs/test-lib/**/*.ts'],
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
@ -619,7 +618,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
it('should not extend root config if rootProject is set', async () => {
|
it('should not extend root config if rootProject is set', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
eslintFilePatterns: ['libs/test-lib/**/*.ts'],
|
eslintFilePatterns: ['libs/test-lib/**/*.ts'],
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
setParserOptionsProject: false,
|
setParserOptionsProject: false,
|
||||||
@ -633,7 +632,7 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
it('should generate the global eslint config', async () => {
|
it('should generate the global eslint config', async () => {
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'test-lib',
|
project: 'test-lib',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -695,13 +694,13 @@ describe('@nx/eslint:lint-project', () => {
|
|||||||
|
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'explicit-lib',
|
project: 'explicit-lib',
|
||||||
addExplicitTargets: true,
|
addExplicitTargets: true,
|
||||||
});
|
});
|
||||||
await lintProjectGenerator(tree, {
|
await lintProjectGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: 'inferred-lib',
|
project: 'inferred-lib',
|
||||||
addExplicitTargets: false,
|
addExplicitTargets: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/**
|
||||||
* @deprecated Use LinterType instead
|
* @deprecated Use LinterType instead. It will be removed in Nx v22.
|
||||||
*/
|
*/
|
||||||
export enum Linter {
|
export enum Linter {
|
||||||
EsLint = 'eslint',
|
EsLint = 'eslint',
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { expoApplicationGenerator } from './application';
|
import { expoApplicationGenerator } from './application';
|
||||||
|
|
||||||
describe('app', () => {
|
describe('app', () => {
|
||||||
@ -24,7 +23,7 @@ describe('app', () => {
|
|||||||
await expoApplicationGenerator(appTree, {
|
await expoApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: false,
|
js: false,
|
||||||
@ -40,7 +39,7 @@ describe('app', () => {
|
|||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
tags: 'one,two',
|
tags: 'one,two',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: false,
|
js: false,
|
||||||
@ -57,7 +56,7 @@ describe('app', () => {
|
|||||||
await expoApplicationGenerator(appTree, {
|
await expoApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: false,
|
js: false,
|
||||||
@ -76,7 +75,7 @@ describe('app', () => {
|
|||||||
await expoApplicationGenerator(appTree, {
|
await expoApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
@ -96,7 +95,7 @@ describe('app', () => {
|
|||||||
await expoApplicationGenerator(appTree, {
|
await expoApplicationGenerator(appTree, {
|
||||||
name: 'my-app',
|
name: 'my-app',
|
||||||
directory: 'my-dir',
|
directory: 'my-dir',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'detox',
|
e2eTestRunner: 'detox',
|
||||||
js: false,
|
js: false,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
@ -157,7 +156,7 @@ describe('app', () => {
|
|||||||
it('should create e2e app without directory', async () => {
|
it('should create e2e app without directory', async () => {
|
||||||
await expoApplicationGenerator(appTree, {
|
await expoApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'detox',
|
e2eTestRunner: 'detox',
|
||||||
js: false,
|
js: false,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
@ -218,7 +217,7 @@ describe('app', () => {
|
|||||||
await expoApplicationGenerator(appTree, {
|
await expoApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'my app name',
|
displayName: 'my app name',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'detox',
|
e2eTestRunner: 'detox',
|
||||||
js: false,
|
js: false,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
@ -306,7 +305,7 @@ describe('app', () => {
|
|||||||
await expoApplicationGenerator(tree, {
|
await expoApplicationGenerator(tree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: false,
|
js: false,
|
||||||
@ -436,7 +435,7 @@ describe('app', () => {
|
|||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
name: 'my-app',
|
name: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: false,
|
js: false,
|
||||||
@ -462,7 +461,7 @@ describe('app', () => {
|
|||||||
it('should generate project.json if useProjectJson is true', async () => {
|
it('should generate project.json if useProjectJson is true', async () => {
|
||||||
await expoApplicationGenerator(tree, {
|
await expoApplicationGenerator(tree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
useProjectJson: true,
|
useProjectJson: true,
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { Schema } from '../schema';
|
import { Schema } from '../schema';
|
||||||
import { NormalizedSchema, normalizeOptions } from './normalize-options';
|
import { NormalizedSchema, normalizeOptions } from './normalize-options';
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ describe('Normalize Options', () => {
|
|||||||
it('should normalize options with name in kebab case', async () => {
|
it('should normalize options with name in kebab case', async () => {
|
||||||
const schema: Schema = {
|
const schema: Schema = {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
@ -31,7 +30,7 @@ describe('Normalize Options', () => {
|
|||||||
simpleName: 'my-app',
|
simpleName: 'my-app',
|
||||||
parsedTags: [],
|
parsedTags: [],
|
||||||
projectName: 'my-app',
|
projectName: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
importPath: '@proj/my-app',
|
importPath: '@proj/my-app',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -48,7 +47,7 @@ describe('Normalize Options', () => {
|
|||||||
it('should normalize options with name in camel case', async () => {
|
it('should normalize options with name in camel case', async () => {
|
||||||
const schema: Schema = {
|
const schema: Schema = {
|
||||||
directory: 'myApp',
|
directory: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
@ -65,7 +64,7 @@ describe('Normalize Options', () => {
|
|||||||
simpleName: 'myApp',
|
simpleName: 'myApp',
|
||||||
parsedTags: [],
|
parsedTags: [],
|
||||||
projectName: 'myApp',
|
projectName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
importPath: '@proj/myApp',
|
importPath: '@proj/myApp',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
@ -83,7 +82,7 @@ describe('Normalize Options', () => {
|
|||||||
const schema: Schema = {
|
const schema: Schema = {
|
||||||
name: 'my-app',
|
name: 'my-app',
|
||||||
directory: 'directory',
|
directory: 'directory',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
@ -104,7 +103,7 @@ describe('Normalize Options', () => {
|
|||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
importPath: '@proj/my-app',
|
importPath: '@proj/my-app',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
rootProject: false,
|
rootProject: false,
|
||||||
@ -118,7 +117,7 @@ describe('Normalize Options', () => {
|
|||||||
it('should normalize options that has directory in its name', async () => {
|
it('should normalize options that has directory in its name', async () => {
|
||||||
const schema: Schema = {
|
const schema: Schema = {
|
||||||
directory: 'directory/my-app',
|
directory: 'directory/my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
@ -138,7 +137,7 @@ describe('Normalize Options', () => {
|
|||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
importPath: '@proj/my-app',
|
importPath: '@proj/my-app',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
rootProject: false,
|
rootProject: false,
|
||||||
@ -153,7 +152,7 @@ describe('Normalize Options', () => {
|
|||||||
const schema: Schema = {
|
const schema: Schema = {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'My App',
|
displayName: 'My App',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
@ -173,7 +172,7 @@ describe('Normalize Options', () => {
|
|||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
importPath: '@proj/my-app',
|
importPath: '@proj/my-app',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
rootProject: false,
|
rootProject: false,
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
|
|
||||||
import { logger, Tree } from '@nx/devkit';
|
import { logger, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import expoApplicationGenerator from '../application/application';
|
import expoApplicationGenerator from '../application/application';
|
||||||
import expoLibraryGenerator from '../library/library';
|
import expoLibraryGenerator from '../library/library';
|
||||||
import { expoComponentGenerator } from './component';
|
import { expoComponentGenerator } from './component';
|
||||||
@ -29,7 +28,7 @@ describe('component', () => {
|
|||||||
|
|
||||||
await expoApplicationGenerator(appTree, {
|
await expoApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
js: true,
|
js: true,
|
||||||
@ -37,7 +36,7 @@ describe('component', () => {
|
|||||||
});
|
});
|
||||||
await expoLibraryGenerator(appTree, {
|
await expoLibraryGenerator(appTree, {
|
||||||
directory: projectName,
|
directory: projectName,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import 'nx/src/internal-testing-utils/mock-project-graph';
|
import 'nx/src/internal-testing-utils/mock-project-graph';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getProjects,
|
|
||||||
readJson,
|
readJson,
|
||||||
readProjectConfiguration,
|
readProjectConfiguration,
|
||||||
Tree,
|
Tree,
|
||||||
@ -9,7 +8,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { hasPlugin as hasRollupPlugin } from '@nx/rollup/src/utils/has-plugin';
|
import { hasPlugin as hasRollupPlugin } from '@nx/rollup/src/utils/has-plugin';
|
||||||
import { expoLibraryGenerator } from './library';
|
import { expoLibraryGenerator } from './library';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
@ -19,7 +17,7 @@ describe('lib', () => {
|
|||||||
|
|
||||||
const defaultSchema: Schema = {
|
const defaultSchema: Schema = {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
|
|
||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { libraryGenerator } from '@nx/js';
|
import { libraryGenerator } from '@nx/js';
|
||||||
import { addLinting } from './add-linting';
|
import { addLinting } from './add-linting';
|
||||||
|
|
||||||
@ -13,14 +12,14 @@ describe('Add Linting', () => {
|
|||||||
tree = createTreeWithEmptyWorkspace();
|
tree = createTreeWithEmptyWorkspace();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add update configuration when eslint is passed', async () => {
|
it('should add update configuration when eslint is passed', async () => {
|
||||||
await addLinting(tree, {
|
await addLinting(tree, {
|
||||||
projectName: 'my-lib',
|
projectName: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
tsConfigPaths: ['my-lib/tsconfig.lib.json'],
|
tsConfigPaths: ['my-lib/tsconfig.lib.json'],
|
||||||
projectRoot: 'my-lib',
|
projectRoot: 'my-lib',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
@ -32,7 +31,7 @@ describe('Add Linting', () => {
|
|||||||
it('should not add lint target when "none" is passed', async () => {
|
it('should not add lint target when "none" is passed', async () => {
|
||||||
await addLinting(tree, {
|
await addLinting(tree, {
|
||||||
projectName: 'my-lib',
|
projectName: 'my-lib',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
tsConfigPaths: ['my-lib/tsconfig.lib.json'],
|
tsConfigPaths: ['my-lib/tsconfig.lib.json'],
|
||||||
projectRoot: 'my-lib',
|
projectRoot: 'my-lib',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
|
|||||||
@ -26,7 +26,7 @@ interface NormalizedSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
||||||
if (options.linter === Linter.None) {
|
if (options.linter === 'none') {
|
||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
const tasks: GeneratorCallback[] = [];
|
const tasks: GeneratorCallback[] = [];
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import {
|
|||||||
determineProjectNameAndRootOptions,
|
determineProjectNameAndRootOptions,
|
||||||
ensureRootProjectName,
|
ensureRootProjectName,
|
||||||
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';
|
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';
|
||||||
import type { Schema as NodeApplicationGeneratorOptions } from '@nx/node/src/generators/application/schema';
|
import type { Schema as NodeApplicationGeneratorOptions } from '@nx/node/src/generators/application/schema';
|
||||||
import type { ApplicationGeneratorOptions, NormalizedOptions } from '../schema';
|
import type { ApplicationGeneratorOptions, NormalizedOptions } from '../schema';
|
||||||
@ -33,7 +32,7 @@ export async function normalizeOptions(
|
|||||||
strict: options.strict ?? false,
|
strict: options.strict ?? false,
|
||||||
appProjectName,
|
appProjectName,
|
||||||
appProjectRoot,
|
appProjectRoot,
|
||||||
linter: options.linter ?? Linter.EsLint,
|
linter: options.linter ?? 'eslint',
|
||||||
unitTestRunner: options.unitTestRunner ?? 'jest',
|
unitTestRunner: options.unitTestRunner ?? 'jest',
|
||||||
e2eTestRunner: options.e2eTestRunner ?? 'jest',
|
e2eTestRunner: options.e2eTestRunner ?? 'jest',
|
||||||
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionSetup(tree),
|
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionSetup(tree),
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import {
|
|||||||
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||||
import { getNpmScope } from '@nx/js/src/utils/package-json/get-npm-scope';
|
import { getNpmScope } from '@nx/js/src/utils/package-json/get-npm-scope';
|
||||||
import type { LibraryGeneratorSchema as JsLibraryGeneratorSchema } from '@nx/js/src/generators/library/schema';
|
import type { LibraryGeneratorSchema as JsLibraryGeneratorSchema } from '@nx/js/src/generators/library/schema';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import type { LibraryGeneratorOptions, NormalizedOptions } from '../schema';
|
import type { LibraryGeneratorOptions, NormalizedOptions } from '../schema';
|
||||||
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';
|
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ export async function normalizeOptions(
|
|||||||
controller: options.controller ?? false,
|
controller: options.controller ?? false,
|
||||||
fileName,
|
fileName,
|
||||||
global: options.global ?? false,
|
global: options.global ?? false,
|
||||||
linter: options.linter ?? Linter.EsLint,
|
linter: options.linter ?? 'eslint',
|
||||||
parsedTags,
|
parsedTags,
|
||||||
prefix: getNpmScope(tree), // we could also allow customizing this
|
prefix: getNpmScope(tree), // we could also allow customizing this
|
||||||
projectName:
|
projectName:
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { getE2EWebServerInfo } from '@nx/devkit/src/generators/e2e-web-server-info-utils';
|
import { getE2EWebServerInfo } from '@nx/devkit/src/generators/e2e-web-server-info-utils';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { webStaticServeGenerator } from '@nx/web';
|
import { webStaticServeGenerator } from '@nx/web';
|
||||||
import type { PackageJson } from 'nx/src/utils/package-json';
|
import type { PackageJson } from 'nx/src/utils/package-json';
|
||||||
import { nxVersion } from '../../../utils/versions';
|
import { nxVersion } from '../../../utils/versions';
|
||||||
@ -73,7 +72,7 @@ export async function addE2e(host: Tree, options: NormalizedSchema) {
|
|||||||
|
|
||||||
const e2eTask = await configurationGenerator(host, {
|
const e2eTask = await configurationGenerator(host, {
|
||||||
...options,
|
...options,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
project: options.e2eProjectName,
|
project: options.e2eProjectName,
|
||||||
directory: 'src',
|
directory: 'src',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import {
|
|||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { addLinting } from './add-linting';
|
import { addLinting } from './add-linting';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { NormalizedSchema } from './normalize-options';
|
import { NormalizedSchema } from './normalize-options';
|
||||||
|
|
||||||
describe('updateEslint', () => {
|
describe('updateEslint', () => {
|
||||||
@ -20,7 +19,7 @@ describe('updateEslint', () => {
|
|||||||
appProjectRoot: 'my-app',
|
appProjectRoot: 'my-app',
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
importPath: '@proj/my-app',
|
importPath: '@proj/my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
e2eProjectName: 'my-app-e2e',
|
e2eProjectName: 'my-app-e2e',
|
||||||
e2eProjectRoot: 'my-app-e2e',
|
e2eProjectRoot: 'my-app-e2e',
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Linter, lintProjectGenerator } from '@nx/eslint';
|
import { lintProjectGenerator } from '@nx/eslint';
|
||||||
import {
|
import {
|
||||||
addDependenciesToPackageJson,
|
addDependenciesToPackageJson,
|
||||||
GeneratorCallback,
|
GeneratorCallback,
|
||||||
@ -41,7 +41,7 @@ export async function addLinting(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (options.linter === Linter.EsLint && isEslintConfigSupported(host)) {
|
if (options.linter === 'eslint' && isEslintConfigSupported(host)) {
|
||||||
if (useFlatConfig(host)) {
|
if (useFlatConfig(host)) {
|
||||||
addPredefinedConfigToFlatLintConfig(
|
addPredefinedConfigToFlatLintConfig(
|
||||||
host,
|
host,
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import { joinPathFragments, names, readNxJson, Tree } from '@nx/devkit';
|
import { joinPathFragments, readNxJson, Tree } from '@nx/devkit';
|
||||||
import {
|
import {
|
||||||
determineProjectNameAndRootOptions,
|
determineProjectNameAndRootOptions,
|
||||||
ensureRootProjectName,
|
ensureRootProjectName,
|
||||||
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { assertValidStyle } from '@nx/react/src/utils/assertion';
|
import { assertValidStyle } from '@nx/react/src/utils/assertion';
|
||||||
import { Schema } from '../schema';
|
import { Schema } from '../schema';
|
||||||
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';
|
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';
|
||||||
@ -87,7 +86,7 @@ export async function normalizeOptions(
|
|||||||
e2eProjectRoot,
|
e2eProjectRoot,
|
||||||
e2eTestRunner: options.e2eTestRunner || 'playwright',
|
e2eTestRunner: options.e2eTestRunner || 'playwright',
|
||||||
fileName,
|
fileName,
|
||||||
linter: options.linter || Linter.EsLint,
|
linter: options.linter || 'eslint',
|
||||||
outputPath,
|
outputPath,
|
||||||
parsedTags,
|
parsedTags,
|
||||||
projectName: appProjectName,
|
projectName: appProjectName,
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import { componentGenerator } from './component';
|
|||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { libraryGenerator } from '@nx/react';
|
import { libraryGenerator } from '@nx/react';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
describe('component', () => {
|
describe('component', () => {
|
||||||
let tree: Tree;
|
let tree: Tree;
|
||||||
@ -18,7 +17,7 @@ describe('component', () => {
|
|||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: libName,
|
directory: libName,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import type { Tree } from '@nx/devkit';
|
import type { Tree } from '@nx/devkit';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { normalizeOptions } from './normalize-options';
|
import { normalizeOptions } from './normalize-options';
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ describe('normalizeOptions', () => {
|
|||||||
const options = await normalizeOptions(tree, {
|
const options = await normalizeOptions(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import libraryGenerator from './library';
|
import libraryGenerator from './library';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ describe('next library', () => {
|
|||||||
it('should use @nx/next images.d.ts file', async () => {
|
it('should use @nx/next images.d.ts file', async () => {
|
||||||
const baseOptions: Schema = {
|
const baseOptions: Schema = {
|
||||||
directory: '',
|
directory: '',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -47,7 +46,7 @@ describe('next library', () => {
|
|||||||
it('should add jsxImportSource in tsconfig.json for @emotion/styled', async () => {
|
it('should add jsxImportSource in tsconfig.json for @emotion/styled', async () => {
|
||||||
const baseOptions: Schema = {
|
const baseOptions: Schema = {
|
||||||
directory: '',
|
directory: '',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -79,7 +78,7 @@ describe('next library', () => {
|
|||||||
const appTree = createTreeWithEmptyWorkspace();
|
const appTree = createTreeWithEmptyWorkspace();
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
directory: 'my-buildable-lib',
|
directory: 'my-buildable-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -95,7 +94,7 @@ describe('next library', () => {
|
|||||||
|
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -122,7 +121,7 @@ describe('next library', () => {
|
|||||||
|
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -164,7 +163,7 @@ describe('next library', () => {
|
|||||||
it('should add project references when using TS solution', async () => {
|
it('should add project references when using TS solution', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'mylib',
|
directory: 'mylib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -287,7 +286,7 @@ describe('next library', () => {
|
|||||||
const appTree = createTreeWithEmptyWorkspace();
|
const appTree = createTreeWithEmptyWorkspace();
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
directory: 'my-buildable-lib',
|
directory: 'my-buildable-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -302,7 +301,7 @@ describe('next library', () => {
|
|||||||
it('should create a correct package.json for buildable libraries', async () => {
|
it('should create a correct package.json for buildable libraries', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'mylib',
|
directory: 'mylib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -387,7 +386,7 @@ describe('next library', () => {
|
|||||||
|
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'mylib',
|
directory: 'mylib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -448,7 +447,7 @@ describe('next library', () => {
|
|||||||
it('should generate project.json if useProjectJson is true', async () => {
|
it('should generate project.json if useProjectJson is true', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'mylib',
|
directory: 'mylib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import {
|
|||||||
tsConfigBaseOptions,
|
tsConfigBaseOptions,
|
||||||
} from '@nx/js';
|
} from '@nx/js';
|
||||||
import { esbuildVersion } from '@nx/js/src/utils/versions';
|
import { esbuildVersion } from '@nx/js/src/utils/versions';
|
||||||
import { Linter, lintProjectGenerator } from '@nx/eslint';
|
import { lintProjectGenerator } from '@nx/eslint';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import {
|
import {
|
||||||
expressTypingsVersion,
|
expressTypingsVersion,
|
||||||
@ -541,7 +541,7 @@ export async function applicationGeneratorInternal(tree: Tree, schema: Schema) {
|
|||||||
|
|
||||||
updateTsConfigOptions(tree, options);
|
updateTsConfigOptions(tree, options);
|
||||||
|
|
||||||
if (options.linter === Linter.EsLint) {
|
if (options.linter === 'eslint') {
|
||||||
const lintTask = await addLintingToApplication(tree, options);
|
const lintTask = await addLintingToApplication(tree, options);
|
||||||
tasks.push(lintTask);
|
tasks.push(lintTask);
|
||||||
}
|
}
|
||||||
@ -678,7 +678,7 @@ async function normalizeOptions(
|
|||||||
appProjectRoot,
|
appProjectRoot,
|
||||||
importPath,
|
importPath,
|
||||||
parsedTags,
|
parsedTags,
|
||||||
linter: options.linter ?? Linter.EsLint,
|
linter: options.linter ?? 'eslint',
|
||||||
unitTestRunner: options.unitTestRunner ?? 'jest',
|
unitTestRunner: options.unitTestRunner ?? 'jest',
|
||||||
rootProject: options.rootProject ?? false,
|
rootProject: options.rootProject ?? false,
|
||||||
port: options.port ?? 3000,
|
port: options.port ?? 3000,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { determineProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
import { determineProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||||
import { Linter, lintProjectGenerator } from '@nx/eslint';
|
import { lintProjectGenerator } from '@nx/eslint';
|
||||||
import {
|
import {
|
||||||
javaScriptOverride,
|
javaScriptOverride,
|
||||||
typeScriptOverride,
|
typeScriptOverride,
|
||||||
@ -230,10 +230,10 @@ export async function e2eProjectGeneratorInternal(
|
|||||||
);
|
);
|
||||||
tasks.push(installTask);
|
tasks.push(installTask);
|
||||||
|
|
||||||
if (options.linter === Linter.EsLint) {
|
if (options.linter === 'eslint') {
|
||||||
const linterTask = await lintProjectGenerator(host, {
|
const linterTask = await lintProjectGenerator(host, {
|
||||||
project: options.e2eProjectName,
|
project: options.e2eProjectName,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
tsConfigPaths: [
|
tsConfigPaths: [
|
||||||
joinPathFragments(options.e2eProjectRoot, 'tsconfig.json'),
|
joinPathFragments(options.e2eProjectRoot, 'tsconfig.json'),
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import {
|
|||||||
initGenerator as jsInitGenerator,
|
initGenerator as jsInitGenerator,
|
||||||
} from '@nx/js';
|
} from '@nx/js';
|
||||||
import { updateGitIgnore } from '../../utils/update-gitignore';
|
import { updateGitIgnore } from '../../utils/update-gitignore';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { addE2e } from './lib/add-e2e';
|
import { addE2e } from './lib/add-e2e';
|
||||||
import { addLinting } from '../../utils/add-linting';
|
import { addLinting } from '../../utils/add-linting';
|
||||||
import { addVitest } from './lib/add-vitest';
|
import { addVitest } from './lib/add-vitest';
|
||||||
@ -167,7 +166,7 @@ export async function applicationGeneratorInternal(tree: Tree, schema: Schema) {
|
|||||||
await addLinting(tree, {
|
await addLinting(tree, {
|
||||||
projectName: options.projectName,
|
projectName: options.projectName,
|
||||||
projectRoot: options.appProjectRoot,
|
projectRoot: options.appProjectRoot,
|
||||||
linter: options.linter ?? Linter.EsLint,
|
linter: options.linter ?? 'eslint',
|
||||||
unitTestRunner: options.unitTestRunner,
|
unitTestRunner: options.unitTestRunner,
|
||||||
rootProject: options.rootProject,
|
rootProject: options.rootProject,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
|
|
||||||
import { logger, Tree } from '@nx/devkit';
|
import { logger, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import applicationGenerator from '../application/application';
|
import applicationGenerator from '../application/application';
|
||||||
import storybookConfigurationGenerator from './configuration';
|
import storybookConfigurationGenerator from './configuration';
|
||||||
import { componentGenerator } from '@nx/vue';
|
import { componentGenerator } from '@nx/vue';
|
||||||
@ -84,7 +83,7 @@ export async function createTestApp(
|
|||||||
|
|
||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export async function addLinterToPlaywrightProject(
|
|||||||
tree: Tree,
|
tree: Tree,
|
||||||
options: PlaywrightLinterOptions
|
options: PlaywrightLinterOptions
|
||||||
): Promise<GeneratorCallback> {
|
): Promise<GeneratorCallback> {
|
||||||
if (options.linter === Linter.None) {
|
if (options.linter === 'none') {
|
||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ export async function addLinterToPlaywrightProject(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options.linter || options.linter !== Linter.EsLint) {
|
if (!options.linter || options.linter !== 'eslint') {
|
||||||
return runTasksInSerial(...tasks);
|
return runTasksInSerial(...tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import {
|
|||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { PackageJson } from 'nx/src/utils/package-json';
|
import { PackageJson } from 'nx/src/utils/package-json';
|
||||||
import pluginGenerator from '../plugin/plugin';
|
import pluginGenerator from '../plugin/plugin';
|
||||||
import { createPackageGenerator } from './create-package';
|
import { createPackageGenerator } from './create-package';
|
||||||
@ -26,7 +25,7 @@ const getSchema: (
|
|||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipLintChecks: false,
|
skipLintChecks: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
...overrides,
|
...overrides,
|
||||||
});
|
});
|
||||||
@ -44,7 +43,7 @@ describe('NxPlugin Create Package Generator', () => {
|
|||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipLintChecks: false,
|
skipLintChecks: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import { executorGenerator } from './executor';
|
|||||||
import { pluginGenerator } from '../plugin/plugin';
|
import { pluginGenerator } from '../plugin/plugin';
|
||||||
import { libraryGenerator as jsLibraryGenerator } from '@nx/js';
|
import { libraryGenerator as jsLibraryGenerator } from '@nx/js';
|
||||||
import { setCwd } from '@nx/devkit/internal-testing-utils';
|
import { setCwd } from '@nx/devkit/internal-testing-utils';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
describe('NxPlugin Executor Generator', () => {
|
describe('NxPlugin Executor Generator', () => {
|
||||||
let tree: Tree;
|
let tree: Tree;
|
||||||
@ -20,7 +19,7 @@ describe('NxPlugin Executor Generator', () => {
|
|||||||
await pluginGenerator(tree, {
|
await pluginGenerator(tree, {
|
||||||
directory: projectName,
|
directory: projectName,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
compiler: 'tsc',
|
compiler: 'tsc',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|||||||
import { libraryGenerator as jsLibraryGenerator } from '@nx/js';
|
import { libraryGenerator as jsLibraryGenerator } from '@nx/js';
|
||||||
import { pluginGenerator } from '../plugin/plugin';
|
import { pluginGenerator } from '../plugin/plugin';
|
||||||
import { generatorGenerator } from './generator';
|
import { generatorGenerator } from './generator';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { setCwd } from '@nx/devkit/internal-testing-utils';
|
import { setCwd } from '@nx/devkit/internal-testing-utils';
|
||||||
|
|
||||||
describe('NxPlugin Generator Generator', () => {
|
describe('NxPlugin Generator Generator', () => {
|
||||||
@ -24,7 +23,7 @@ describe('NxPlugin Generator Generator', () => {
|
|||||||
await pluginGenerator(tree, {
|
await pluginGenerator(tree, {
|
||||||
directory: projectName,
|
directory: projectName,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
compiler: 'tsc',
|
compiler: 'tsc',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import {
|
|||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
|
|
||||||
import type { Linter as ESLint } from 'eslint';
|
import type { Linter as ESLint } from 'eslint';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
import generator from './generator';
|
import generator from './generator';
|
||||||
import pluginGenerator from '../plugin/plugin';
|
import pluginGenerator from '../plugin/plugin';
|
||||||
@ -29,7 +28,7 @@ describe('lint-checks generator', () => {
|
|||||||
directory: 'plugin',
|
directory: 'plugin',
|
||||||
importPath: '@acme/plugin',
|
importPath: '@acme/plugin',
|
||||||
compiler: 'tsc',
|
compiler: 'tsc',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
skipLintChecks: true, // we manually call it s.t. we can update config files first
|
skipLintChecks: true, // we manually call it s.t. we can update config files first
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|||||||
import { migrationGenerator } from './migration';
|
import { migrationGenerator } from './migration';
|
||||||
import { pluginGenerator } from '../plugin/plugin';
|
import { pluginGenerator } from '../plugin/plugin';
|
||||||
import { setCwd } from '@nx/devkit/internal-testing-utils';
|
import { setCwd } from '@nx/devkit/internal-testing-utils';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
describe('NxPlugin migration generator', () => {
|
describe('NxPlugin migration generator', () => {
|
||||||
let tree: Tree;
|
let tree: Tree;
|
||||||
@ -20,7 +19,7 @@ describe('NxPlugin migration generator', () => {
|
|||||||
name: projectName,
|
name: projectName,
|
||||||
directory: 'packages/my-plugin',
|
directory: 'packages/my-plugin',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
compiler: 'tsc',
|
compiler: 'tsc',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { PackageJson } from 'nx/src/utils/package-json';
|
import { PackageJson } from 'nx/src/utils/package-json';
|
||||||
import { pluginGenerator } from './plugin';
|
import { pluginGenerator } from './plugin';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
@ -23,7 +22,7 @@ const getSchema: (overrides?: Partial<Schema>) => Schema = (
|
|||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipLintChecks: false,
|
skipLintChecks: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
...overrides,
|
...overrides,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import {
|
|||||||
updateJson,
|
updateJson,
|
||||||
updateProjectConfiguration,
|
updateProjectConfiguration,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { libraryGenerator as jsLibraryGenerator } from '@nx/js';
|
import { libraryGenerator as jsLibraryGenerator } from '@nx/js';
|
||||||
import {
|
import {
|
||||||
addSwcDependencies,
|
addSwcDependencies,
|
||||||
@ -161,7 +160,7 @@ export async function pluginGeneratorInternal(host: Tree, schema: Schema) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.linter === Linter.EsLint && !options.skipLintChecks) {
|
if (options.linter === 'eslint' && !options.skipLintChecks) {
|
||||||
await pluginLintCheckGenerator(host, { projectName: options.projectName });
|
await pluginLintCheckGenerator(host, { projectName: options.projectName });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { reactNativeApplicationGenerator } from './application';
|
import { reactNativeApplicationGenerator } from './application';
|
||||||
|
|
||||||
describe('app', () => {
|
describe('app', () => {
|
||||||
@ -24,7 +23,7 @@ describe('app', () => {
|
|||||||
await reactNativeApplicationGenerator(appTree, {
|
await reactNativeApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -40,7 +39,7 @@ describe('app', () => {
|
|||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
tags: 'one,two',
|
tags: 'one,two',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -57,7 +56,7 @@ describe('app', () => {
|
|||||||
await reactNativeApplicationGenerator(appTree, {
|
await reactNativeApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -102,7 +101,7 @@ describe('app', () => {
|
|||||||
await reactNativeApplicationGenerator(appTree, {
|
await reactNativeApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -118,7 +117,7 @@ describe('app', () => {
|
|||||||
await reactNativeApplicationGenerator(appTree, {
|
await reactNativeApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -134,7 +133,7 @@ describe('app', () => {
|
|||||||
await reactNativeApplicationGenerator(appTree, {
|
await reactNativeApplicationGenerator(appTree, {
|
||||||
name: 'my-app',
|
name: 'my-app',
|
||||||
directory: 'my-dir',
|
directory: 'my-dir',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'detox',
|
e2eTestRunner: 'detox',
|
||||||
install: false,
|
install: false,
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
@ -185,7 +184,7 @@ describe('app', () => {
|
|||||||
it('should create e2e app without directory', async () => {
|
it('should create e2e app without directory', async () => {
|
||||||
await reactNativeApplicationGenerator(appTree, {
|
await reactNativeApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'detox',
|
e2eTestRunner: 'detox',
|
||||||
install: false,
|
install: false,
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
@ -240,7 +239,7 @@ describe('app', () => {
|
|||||||
await reactNativeApplicationGenerator(appTree, {
|
await reactNativeApplicationGenerator(appTree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
skipPackageJson: true,
|
skipPackageJson: true,
|
||||||
@ -280,7 +279,7 @@ describe('app', () => {
|
|||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
tags: 'one,two',
|
tags: 'one,two',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -417,7 +416,7 @@ describe('app', () => {
|
|||||||
name: 'my-app',
|
name: 'my-app',
|
||||||
displayName: 'myApp',
|
displayName: 'myApp',
|
||||||
tags: 'one,two',
|
tags: 'one,two',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -443,7 +442,7 @@ describe('app', () => {
|
|||||||
it('should generate project.json if useProjectJson is true', async () => {
|
it('should generate project.json if useProjectJson is true', async () => {
|
||||||
await reactNativeApplicationGenerator(tree, {
|
await reactNativeApplicationGenerator(tree, {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { Schema } from '../schema';
|
import { Schema } from '../schema';
|
||||||
import { normalizeOptions } from './normalize-options';
|
import { normalizeOptions } from './normalize-options';
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ describe('Normalize Options', () => {
|
|||||||
it('should normalize options with name in kebab case', async () => {
|
it('should normalize options with name in kebab case', async () => {
|
||||||
const schema: Schema = {
|
const schema: Schema = {
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -35,7 +34,7 @@ describe('Normalize Options', () => {
|
|||||||
name: 'my-app',
|
name: 'my-app',
|
||||||
parsedTags: [],
|
parsedTags: [],
|
||||||
projectName: 'my-app',
|
projectName: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
entryFile: 'src/main.tsx',
|
entryFile: 'src/main.tsx',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -54,7 +53,7 @@ describe('Normalize Options', () => {
|
|||||||
directory: 'myApp',
|
directory: 'myApp',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
};
|
};
|
||||||
@ -78,7 +77,7 @@ describe('Normalize Options', () => {
|
|||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
rootProject: false,
|
rootProject: false,
|
||||||
e2eProjectName: 'myApp-e2e',
|
e2eProjectName: 'myApp-e2e',
|
||||||
e2eProjectRoot: 'myApp-e2e',
|
e2eProjectRoot: 'myApp-e2e',
|
||||||
@ -93,7 +92,7 @@ describe('Normalize Options', () => {
|
|||||||
directory: 'directory/my-app',
|
directory: 'directory/my-app',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
};
|
};
|
||||||
@ -117,7 +116,7 @@ describe('Normalize Options', () => {
|
|||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
rootProject: false,
|
rootProject: false,
|
||||||
e2eProjectName: 'my-app-e2e',
|
e2eProjectName: 'my-app-e2e',
|
||||||
e2eProjectRoot: 'directory/my-app-e2e',
|
e2eProjectRoot: 'directory/my-app-e2e',
|
||||||
@ -131,7 +130,7 @@ describe('Normalize Options', () => {
|
|||||||
directory: 'directory/my-app',
|
directory: 'directory/my-app',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
};
|
};
|
||||||
@ -155,7 +154,7 @@ describe('Normalize Options', () => {
|
|||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
rootProject: false,
|
rootProject: false,
|
||||||
e2eProjectName: 'my-app-e2e',
|
e2eProjectName: 'my-app-e2e',
|
||||||
e2eProjectRoot: 'directory/my-app-e2e',
|
e2eProjectRoot: 'directory/my-app-e2e',
|
||||||
@ -170,7 +169,7 @@ describe('Normalize Options', () => {
|
|||||||
displayName: 'My App',
|
displayName: 'My App',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
};
|
};
|
||||||
@ -194,7 +193,7 @@ describe('Normalize Options', () => {
|
|||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
install: false,
|
install: false,
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
rootProject: false,
|
rootProject: false,
|
||||||
e2eProjectName: 'my-app-e2e',
|
e2eProjectName: 'my-app-e2e',
|
||||||
e2eProjectRoot: 'my-app-e2e',
|
e2eProjectRoot: 'my-app-e2e',
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import libraryGenerator from './library';
|
import libraryGenerator from './library';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { hasPlugin as hasRollupPlugin } from '@nx/rollup/src/utils/has-plugin';
|
import { hasPlugin as hasRollupPlugin } from '@nx/rollup/src/utils/has-plugin';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ describe('lib', () => {
|
|||||||
|
|
||||||
const defaultSchema: Schema = {
|
const defaultSchema: Schema = {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
|
|
||||||
import { readProjectConfiguration, Tree } from '@nx/devkit';
|
import { readProjectConfiguration, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { libraryGenerator } from '@nx/js';
|
import { libraryGenerator } from '@nx/js';
|
||||||
import { addLinting } from './add-linting';
|
import { addLinting } from './add-linting';
|
||||||
|
|
||||||
@ -14,14 +13,14 @@ describe('Add Linting', () => {
|
|||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
name: 'my-lib',
|
name: 'my-lib',
|
||||||
directory: 'libs/my-lib',
|
directory: 'libs/my-lib',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a .eslintrc.json when is passed', async () => {
|
it('should add a .eslintrc.json when is passed', async () => {
|
||||||
await addLinting(tree, {
|
await addLinting(tree, {
|
||||||
projectName: 'my-lib',
|
projectName: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'],
|
tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'],
|
||||||
projectRoot: 'libs/my-lib',
|
projectRoot: 'libs/my-lib',
|
||||||
});
|
});
|
||||||
@ -32,7 +31,7 @@ describe('Add Linting', () => {
|
|||||||
it('should not add lint target when "none" is passed', async () => {
|
it('should not add lint target when "none" is passed', async () => {
|
||||||
await addLinting(tree, {
|
await addLinting(tree, {
|
||||||
projectName: 'my-lib',
|
projectName: 'my-lib',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'],
|
tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'],
|
||||||
projectRoot: 'libs/my-lib',
|
projectRoot: 'libs/my-lib',
|
||||||
});
|
});
|
||||||
|
|||||||
@ -26,7 +26,7 @@ interface NormalizedSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
||||||
if (options.linter === Linter.None) {
|
if (options.linter === 'none') {
|
||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
const tasks: GeneratorCallback[] = [];
|
const tasks: GeneratorCallback[] = [];
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
import { addProjectConfiguration, names, Tree } from '@nx/devkit';
|
import { addProjectConfiguration, names, Tree } from '@nx/devkit';
|
||||||
import applicationGenerator from '../generators/application/application';
|
import applicationGenerator from '../generators/application/application';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
export async function createApp(tree: Tree, appName: string): Promise<void> {
|
export async function createApp(tree: Tree, appName: string): Promise<void> {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
import { getInstalledCypressMajorVersion } from '@nx/cypress/src/utils/versions';
|
import { getInstalledCypressMajorVersion } from '@nx/cypress/src/utils/versions';
|
||||||
import { readProjectConfiguration, Tree } from '@nx/devkit';
|
import { readProjectConfiguration, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { applicationGenerator } from './application';
|
import { applicationGenerator } from './application';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
// need to mock cypress otherwise it'll use the nx installed version from package.json
|
// need to mock cypress otherwise it'll use the nx installed version from package.json
|
||||||
@ -19,7 +18,7 @@ describe('react app generator (legacy)', () => {
|
|||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
strict: true,
|
strict: true,
|
||||||
addPlugin: false,
|
addPlugin: false,
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { applicationGenerator } from './application';
|
import { applicationGenerator } from './application';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ describe('app', () => {
|
|||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
strict: true,
|
strict: true,
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
@ -685,7 +684,7 @@ describe('app', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should add .eslintrc.json and dependencies', async () => {
|
it('should add .eslintrc.json and dependencies', async () => {
|
||||||
await applicationGenerator(appTree, { ...schema, linter: Linter.EsLint });
|
await applicationGenerator(appTree, { ...schema, linter: 'eslint' });
|
||||||
|
|
||||||
const packageJson = readJson(appTree, '/package.json');
|
const packageJson = readJson(appTree, '/package.json');
|
||||||
|
|
||||||
@ -1327,7 +1326,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
directory: 'myapp',
|
directory: 'myapp',
|
||||||
addPlugin: false,
|
addPlugin: false,
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
});
|
});
|
||||||
@ -1368,7 +1367,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'myapp',
|
directory: 'myapp',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
@ -1537,7 +1536,7 @@ describe('app', () => {
|
|||||||
directory: 'myapp',
|
directory: 'myapp',
|
||||||
name: 'myapp',
|
name: 'myapp',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
@ -1563,7 +1562,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'myapp',
|
directory: 'myapp',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -1573,7 +1572,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'libs/nested1',
|
directory: 'libs/nested1',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -1582,7 +1581,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'libs/nested2',
|
directory: 'libs/nested2',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -1610,7 +1609,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'myapp',
|
directory: 'myapp',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -1620,7 +1619,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'apps/nested1',
|
directory: 'apps/nested1',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -1630,7 +1629,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'apps/nested2',
|
directory: 'apps/nested2',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -1640,7 +1639,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'packages/shared/util',
|
directory: 'packages/shared/util',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -1662,7 +1661,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'apps/my-app',
|
directory: 'apps/my-app',
|
||||||
bundler: 'webpack',
|
bundler: 'webpack',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
@ -1715,7 +1714,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'apps/my-app',
|
directory: 'apps/my-app',
|
||||||
bundler: 'webpack',
|
bundler: 'webpack',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
addPlugin: false,
|
addPlugin: false,
|
||||||
@ -1733,7 +1732,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'apps/my-app',
|
directory: 'apps/my-app',
|
||||||
bundler: 'rspack',
|
bundler: 'rspack',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
addPlugin: false,
|
addPlugin: false,
|
||||||
@ -1751,7 +1750,7 @@ describe('app', () => {
|
|||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
directory: 'myapp',
|
directory: 'myapp',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'none',
|
style: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import {
|
|||||||
ensurePackage,
|
ensurePackage,
|
||||||
readJson,
|
readJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { Linter, lintProjectGenerator } from '@nx/eslint';
|
import { lintProjectGenerator } from '@nx/eslint';
|
||||||
import {
|
import {
|
||||||
addExtendsToLintConfig,
|
addExtendsToLintConfig,
|
||||||
addOverrideToLintConfig,
|
addOverrideToLintConfig,
|
||||||
@ -21,7 +21,7 @@ import { nxVersion } from '../../../utils/versions';
|
|||||||
|
|
||||||
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
||||||
const tasks: GeneratorCallback[] = [];
|
const tasks: GeneratorCallback[] = [];
|
||||||
if (options.linter === Linter.EsLint) {
|
if (options.linter === 'eslint') {
|
||||||
const lintTask = await lintProjectGenerator(host, {
|
const lintTask = await lintProjectGenerator(host, {
|
||||||
linter: options.linter,
|
linter: options.linter,
|
||||||
project: options.projectName,
|
project: options.projectName,
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { getProjects, Tree, updateProjectConfiguration } from '@nx/devkit';
|
|||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import libraryGenerator from '../library/library';
|
import libraryGenerator from '../library/library';
|
||||||
import componentStoryGenerator from './component-story';
|
import componentStoryGenerator from './component-story';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
describe('react:component-story', () => {
|
describe('react:component-story', () => {
|
||||||
let appTree: Tree;
|
let appTree: Tree;
|
||||||
@ -600,7 +599,7 @@ export async function createTestUILib(libName: string): Promise<Tree> {
|
|||||||
let appTree = createTreeWithEmptyWorkspace();
|
let appTree = createTreeWithEmptyWorkspace();
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
directory: libName,
|
directory: libName,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
component: true,
|
component: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
import { assertMinimumCypressVersion } from '@nx/cypress/src/utils/versions';
|
import { assertMinimumCypressVersion } from '@nx/cypress/src/utils/versions';
|
||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import libraryGenerator from '../library/library';
|
import libraryGenerator from '../library/library';
|
||||||
import { componentTestGenerator } from './component-test';
|
import { componentTestGenerator } from './component-test';
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ describe(componentTestGenerator.name, () => {
|
|||||||
it('should create component test for tsx files', async () => {
|
it('should create component test for tsx files', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -39,7 +38,7 @@ describe(componentTestGenerator.name, () => {
|
|||||||
it('should create component test for js files', async () => {
|
it('should create component test for js files', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -60,7 +59,7 @@ describe(componentTestGenerator.name, () => {
|
|||||||
it('should not overwrite exising component test', async () => {
|
it('should not overwrite exising component test', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -82,7 +81,7 @@ describe(componentTestGenerator.name, () => {
|
|||||||
it('should not throw if path is invalid', async () => {
|
it('should not throw if path is invalid', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -102,7 +101,7 @@ describe(componentTestGenerator.name, () => {
|
|||||||
it('should handle being provided the full path to the component', async () => {
|
it('should handle being provided the full path to the component', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -123,7 +122,7 @@ describe(componentTestGenerator.name, () => {
|
|||||||
it('should handle props', async () => {
|
it('should handle props', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -163,7 +162,7 @@ export function AnotherCmp(props: AnotherCmpProps) {
|
|||||||
it('should handle no props', async () => {
|
it('should handle no props', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -195,7 +194,7 @@ export function AnotherCmp() {
|
|||||||
it('should handle default export', async () => {
|
it('should handle default export', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -238,7 +237,7 @@ export function AnotherCmp2() {
|
|||||||
it('should handle named exports', async () => {
|
it('should handle named exports', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -283,7 +282,7 @@ export function AnotherCmp2() {
|
|||||||
it('should handle props', async () => {
|
it('should handle props', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -322,7 +321,7 @@ export function AnotherCmp(props: AnotherCmpProps) {
|
|||||||
it('should handle props with inline type', async () => {
|
it('should handle props with inline type', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -357,7 +356,7 @@ export function AnotherCmp(props: AnotherCmpProps) {
|
|||||||
it('should handle destructured props with no type', async () => {
|
it('should handle destructured props with no type', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -393,7 +392,7 @@ export function AnotherCmp(props: AnotherCmpProps) {
|
|||||||
// this is the default behavior of the library component generator
|
// this is the default behavior of the library component generator
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -414,7 +413,7 @@ export function AnotherCmp(props: AnotherCmpProps) {
|
|||||||
it('should handle default export', async () => {
|
it('should handle default export', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -452,7 +451,7 @@ export default function AnotherCmp(props: AnotherCmpProps) {
|
|||||||
it('should handle named exports', async () => {
|
it('should handle named exports', async () => {
|
||||||
mockedAssertMinimumCypressVersion.mockReturnValue();
|
mockedAssertMinimumCypressVersion.mockReturnValue();
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import {
|
|||||||
updateProjectConfiguration,
|
updateProjectConfiguration,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { applicationGenerator } from '../application/application';
|
import { applicationGenerator } from '../application/application';
|
||||||
import { componentGenerator } from '../component/component';
|
import { componentGenerator } from '../component/component';
|
||||||
import { libraryGenerator } from '../library/library';
|
import { libraryGenerator } from '../library/library';
|
||||||
@ -63,7 +62,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
it('should generate cypress config with vite', async () => {
|
it('should generate cypress config with vite', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -71,7 +70,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -117,7 +116,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
it('should generate cypress component test config with --build-target', async () => {
|
it('should generate cypress component test config with --build-target', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -125,7 +124,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -183,7 +182,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
it('should generate cypress component test config with project graph', async () => {
|
it('should generate cypress component test config with project graph', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -191,7 +190,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -248,7 +247,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
it('should generate cypress component test config with webpack', async () => {
|
it('should generate cypress component test config with webpack', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -256,7 +255,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
bundler: 'webpack',
|
bundler: 'webpack',
|
||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -312,7 +311,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
it('should generate tests for existing tsx components', async () => {
|
it('should generate tests for existing tsx components', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -320,7 +319,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -356,7 +355,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
it('should generate tests for existing js components', async () => {
|
it('should generate tests for existing js components', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -364,7 +363,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -410,7 +409,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
it('should throw error when an invalid --build-target is provided', async () => {
|
it('should throw error when an invalid --build-target is provided', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -421,7 +420,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
});
|
});
|
||||||
@ -464,7 +463,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
it('should setup cypress config files correctly', async () => {
|
it('should setup cypress config files correctly', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -472,7 +471,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -563,7 +562,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
|
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'scss',
|
style: 'scss',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
@ -571,7 +570,7 @@ describe('React:CypressComponentTestConfiguration', () => {
|
|||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
});
|
});
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
directory: 'some-lib',
|
directory: 'some-lib',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { Schema } from './schema';
|
|||||||
import { Schema as remoteSchma } from '../remote/schema';
|
import { Schema as remoteSchma } from '../remote/schema';
|
||||||
import { federateModuleGenerator } from './federate-module';
|
import { federateModuleGenerator } from './federate-module';
|
||||||
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports';
|
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import remoteGeneratorInternal from '../remote/remote';
|
import remoteGeneratorInternal from '../remote/remote';
|
||||||
|
|
||||||
describe('federate-module', () => {
|
describe('federate-module', () => {
|
||||||
@ -81,7 +80,7 @@ describe('federate-module', () => {
|
|||||||
directory: 'my-existing-remote',
|
directory: 'my-existing-remote',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
bundler: 'webpack',
|
bundler: 'webpack',
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { Tree, updateJson, writeJson } from '@nx/devkit';
|
|||||||
import { ProjectGraph, readJson } from '@nx/devkit';
|
import { ProjectGraph, readJson } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import hostGenerator from './host';
|
import hostGenerator from './host';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
jest.mock('@nx/devkit', () => {
|
jest.mock('@nx/devkit', () => {
|
||||||
const original = jest.requireActual('@nx/devkit');
|
const original = jest.requireActual('@nx/devkit');
|
||||||
@ -112,7 +111,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -132,7 +131,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -150,7 +149,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: true,
|
typescriptConfiguration: true,
|
||||||
@ -175,7 +174,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -200,7 +199,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -217,7 +216,7 @@ describe('hostGenerator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
ssr: true,
|
ssr: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -259,7 +258,7 @@ describe('hostGenerator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
ssr: true,
|
ssr: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: true,
|
typescriptConfiguration: true,
|
||||||
@ -303,7 +302,7 @@ describe('hostGenerator', () => {
|
|||||||
directory: 'foo/host-app',
|
directory: 'foo/host-app',
|
||||||
remotes: ['remote1', 'remote2', 'remote3'],
|
remotes: ['remote1', 'remote2', 'remote3'],
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -325,7 +324,7 @@ describe('hostGenerator', () => {
|
|||||||
directory: 'foo/host-app',
|
directory: 'foo/host-app',
|
||||||
remotes: ['remote1', 'remote2', 'remote3'],
|
remotes: ['remote1', 'remote2', 'remote3'],
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
typescriptConfiguration: true,
|
typescriptConfiguration: true,
|
||||||
@ -350,7 +349,7 @@ describe('hostGenerator', () => {
|
|||||||
remotes: [remote],
|
remotes: [remote],
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -368,7 +367,7 @@ describe('hostGenerator', () => {
|
|||||||
remotes: [remote],
|
remotes: [remote],
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -448,7 +447,7 @@ describe('hostGenerator', () => {
|
|||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
remotes: ['remote1', 'remote2', 'remote3'],
|
remotes: ['remote1', 'remote2', 'remote3'],
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import * as devkit from '@nx/devkit';
|
|
||||||
import type { Tree } from '@nx/devkit';
|
import type { Tree } from '@nx/devkit';
|
||||||
import { ProjectGraph, readJson } from '@nx/devkit';
|
import { ProjectGraph, readJson } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import hostGenerator from './host';
|
import hostGenerator from './host';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
jest.mock('@nx/devkit', () => {
|
jest.mock('@nx/devkit', () => {
|
||||||
const original = jest.requireActual('@nx/devkit');
|
const original = jest.requireActual('@nx/devkit');
|
||||||
@ -113,7 +111,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -133,7 +131,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -151,7 +149,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: true,
|
typescriptConfiguration: true,
|
||||||
@ -176,7 +174,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -201,7 +199,7 @@ describe('hostGenerator', () => {
|
|||||||
await hostGenerator(tree, {
|
await hostGenerator(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
@ -217,7 +215,7 @@ describe('hostGenerator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
ssr: true,
|
ssr: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -263,7 +261,7 @@ describe('hostGenerator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
ssr: true,
|
ssr: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
typescriptConfiguration: true,
|
typescriptConfiguration: true,
|
||||||
@ -311,7 +309,7 @@ describe('hostGenerator', () => {
|
|||||||
directory: 'foo/host-app',
|
directory: 'foo/host-app',
|
||||||
remotes: ['remote1', 'remote2', 'remote3'],
|
remotes: ['remote1', 'remote2', 'remote3'],
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
@ -333,7 +331,7 @@ describe('hostGenerator', () => {
|
|||||||
directory: 'foo/host-app',
|
directory: 'foo/host-app',
|
||||||
remotes: ['remote1', 'remote2', 'remote3'],
|
remotes: ['remote1', 'remote2', 'remote3'],
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
typescriptConfiguration: true,
|
typescriptConfiguration: true,
|
||||||
@ -358,7 +356,7 @@ describe('hostGenerator', () => {
|
|||||||
remotes: [remote],
|
remotes: [remote],
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
typescriptConfiguration: false,
|
typescriptConfiguration: false,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Tree } from 'nx/src/generators/tree';
|
import { Tree } from 'nx/src/generators/tree';
|
||||||
import { Linter, lintProjectGenerator } from '@nx/eslint';
|
import { lintProjectGenerator } from '@nx/eslint';
|
||||||
import { joinPathFragments } from 'nx/src/utils/path';
|
import { joinPathFragments } from 'nx/src/utils/path';
|
||||||
import {
|
import {
|
||||||
addDependenciesToPackageJson,
|
addDependenciesToPackageJson,
|
||||||
@ -18,7 +18,7 @@ import {
|
|||||||
import { useFlatConfig } from '@nx/eslint/src/utils/flat-config';
|
import { useFlatConfig } from '@nx/eslint/src/utils/flat-config';
|
||||||
|
|
||||||
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
export async function addLinting(host: Tree, options: NormalizedSchema) {
|
||||||
if (options.linter === Linter.EsLint) {
|
if (options.linter === 'eslint') {
|
||||||
const tasks: GeneratorCallback[] = [];
|
const tasks: GeneratorCallback[] = [];
|
||||||
const lintTask = await lintProjectGenerator(host, {
|
const lintTask = await lintProjectGenerator(host, {
|
||||||
linter: options.linter,
|
linter: options.linter,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import type { Tree } from '@nx/devkit';
|
import type { Tree } from '@nx/devkit';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { normalizeOptions } from './normalize-options';
|
import { normalizeOptions } from './normalize-options';
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ describe('normalizeOptions', () => {
|
|||||||
const options = await normalizeOptions(tree, {
|
const options = await normalizeOptions(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ describe('normalizeOptions', () => {
|
|||||||
let options = await normalizeOptions(tree, {
|
let options = await normalizeOptions(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
bundler: 'rollup',
|
bundler: 'rollup',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ describe('normalizeOptions', () => {
|
|||||||
options = await normalizeOptions(tree, {
|
options = await normalizeOptions(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ describe('normalizeOptions', () => {
|
|||||||
const options = await normalizeOptions(tree, {
|
const options = await normalizeOptions(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
});
|
});
|
||||||
@ -73,7 +72,7 @@ describe('normalizeOptions', () => {
|
|||||||
const options = await normalizeOptions(tree, {
|
const options = await normalizeOptions(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
});
|
});
|
||||||
@ -90,7 +89,7 @@ describe('normalizeOptions', () => {
|
|||||||
const options = await normalizeOptions(tree, {
|
const options = await normalizeOptions(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
buildable: true,
|
buildable: true,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
});
|
});
|
||||||
@ -106,7 +105,7 @@ describe('normalizeOptions', () => {
|
|||||||
const options = await normalizeOptions(tree, {
|
const options = await normalizeOptions(tree, {
|
||||||
directory: 'test',
|
directory: 'test',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
buildable: true,
|
buildable: true,
|
||||||
bundler: 'none',
|
bundler: 'none',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { nxVersion } from '../../utils/versions';
|
import { nxVersion } from '../../utils/versions';
|
||||||
import applicationGenerator from '../application/application';
|
import applicationGenerator from '../application/application';
|
||||||
import libraryGenerator from './library';
|
import libraryGenerator from './library';
|
||||||
@ -29,7 +28,7 @@ describe('lib', () => {
|
|||||||
> = getInstalledCypressMajorVersion as never;
|
> = getInstalledCypressMajorVersion as never;
|
||||||
let defaultSchema: Schema = {
|
let defaultSchema: Schema = {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -483,7 +482,7 @@ describe('lib', () => {
|
|||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
compiler: 'babel',
|
compiler: 'babel',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
@ -510,7 +509,7 @@ describe('lib', () => {
|
|||||||
it('should initialize routes if none were set up then add new route', async () => {
|
it('should initialize routes if none were set up then add new route', async () => {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
directory: 'my-app',
|
directory: 'my-app',
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
|
|
||||||
import { readJson, Tree } from '@nx/devkit';
|
import { readJson, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { applicationGenerator } from '../application/application';
|
import { applicationGenerator } from '../application/application';
|
||||||
import { libraryGenerator } from '../library/library';
|
import { libraryGenerator } from '../library/library';
|
||||||
import { reduxGenerator } from './redux';
|
import { reduxGenerator } from './redux';
|
||||||
@ -14,7 +13,7 @@ describe('redux', () => {
|
|||||||
appTree = createTreeWithEmptyWorkspace();
|
appTree = createTreeWithEmptyWorkspace();
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
@ -60,7 +59,7 @@ describe('redux', () => {
|
|||||||
it('should configure app main', async () => {
|
it('should configure app main', async () => {
|
||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import {
|
|||||||
readProjectConfiguration,
|
readProjectConfiguration,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import remote from './remote';
|
import remote from './remote';
|
||||||
import host from '../host/host';
|
import host from '../host/host';
|
||||||
import { getRootTsConfigPathInTree } from '@nx/js';
|
import { getRootTsConfigPathInTree } from '@nx/js';
|
||||||
@ -114,7 +113,7 @@ describe('remote generator', () => {
|
|||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
bundler: 'rspack',
|
bundler: 'rspack',
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
});
|
});
|
||||||
@ -124,7 +123,7 @@ describe('remote generator', () => {
|
|||||||
name: 'remote',
|
name: 'remote',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -143,7 +142,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -175,7 +174,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -208,7 +207,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -235,7 +234,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -252,7 +251,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -270,7 +269,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -292,7 +291,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -317,7 +316,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -344,7 +343,7 @@ describe('remote generator', () => {
|
|||||||
devServerPort: 4209,
|
devServerPort: 4209,
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -362,7 +361,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test/my-app',
|
directory: 'test/my-app',
|
||||||
devServerPort: 4209,
|
devServerPort: 4209,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
|
|
||||||
import { ProjectGraph, readJson, readNxJson } from '@nx/devkit';
|
import { ProjectGraph, readJson, readNxJson } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import remote from './remote';
|
import remote from './remote';
|
||||||
import { getRootTsConfigPathInTree } from '@nx/js';
|
import { getRootTsConfigPathInTree } from '@nx/js';
|
||||||
|
|
||||||
@ -106,7 +105,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -138,7 +137,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -171,7 +170,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -198,7 +197,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -215,7 +214,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -233,7 +232,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -253,7 +252,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -282,7 +281,7 @@ describe('remote generator', () => {
|
|||||||
directory: 'test',
|
directory: 'test',
|
||||||
devServerPort: 4201,
|
devServerPort: 4201,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
@ -313,7 +312,7 @@ describe('remote generator', () => {
|
|||||||
devServerPort: 4209,
|
devServerPort: 4209,
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'jest',
|
unitTestRunner: 'jest',
|
||||||
|
|||||||
@ -1,16 +1,7 @@
|
|||||||
import * as devkit from '@nx/devkit';
|
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import {
|
import { ProjectGraph, readJson, Tree } from '@nx/devkit';
|
||||||
joinPathFragments,
|
|
||||||
ProjectGraph,
|
|
||||||
readCachedProjectGraph,
|
|
||||||
readJson,
|
|
||||||
readNxJson,
|
|
||||||
Tree,
|
|
||||||
} from '@nx/devkit';
|
|
||||||
import applicationGenerator from '../application/application';
|
import applicationGenerator from '../application/application';
|
||||||
import setupSsrGenerator from './setup-ssr';
|
import setupSsrGenerator from './setup-ssr';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
jest.mock('@nx/devkit', () => {
|
jest.mock('@nx/devkit', () => {
|
||||||
const myAppData = {
|
const myAppData = {
|
||||||
@ -126,7 +117,7 @@ describe('setupSsrGenerator', () => {
|
|||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
directory: appName,
|
directory: appName,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
|
|
||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import applicationGenerator from '../application/application';
|
import applicationGenerator from '../application/application';
|
||||||
import storiesGenerator from './stories';
|
import storiesGenerator from './stories';
|
||||||
|
|
||||||
@ -321,7 +320,7 @@ export async function createTestUIApp(
|
|||||||
|
|
||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
e2eTestRunner: 'cypress',
|
e2eTestRunner: 'cypress',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph';
|
|||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import storiesGenerator from './stories';
|
import storiesGenerator from './stories';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import libraryGenerator from '../library/library';
|
import libraryGenerator from '../library/library';
|
||||||
|
|
||||||
describe('react:stories for libraries', () => {
|
describe('react:stories for libraries', () => {
|
||||||
@ -233,7 +232,7 @@ export async function createTestUILib(
|
|||||||
let appTree = createTreeWithEmptyWorkspace();
|
let appTree = createTreeWithEmptyWorkspace();
|
||||||
|
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
component: true,
|
component: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|||||||
// nx-ignore-next-line
|
// nx-ignore-next-line
|
||||||
import { applicationGenerator } from '@nx/next';
|
import { applicationGenerator } from '@nx/next';
|
||||||
/* eslint-enable @nx/enforce-module-boundaries */
|
/* eslint-enable @nx/enforce-module-boundaries */
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
describe('nextjs:stories for applications', () => {
|
describe('nextjs:stories for applications', () => {
|
||||||
let tree: Tree;
|
let tree: Tree;
|
||||||
@ -87,7 +86,7 @@ export async function createTestUIApp(name: string): Promise<Tree> {
|
|||||||
const tree = createTreeWithEmptyWorkspace();
|
const tree = createTreeWithEmptyWorkspace();
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { logger, Tree } from '@nx/devkit';
|
import { logger, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import applicationGenerator from '../application/application';
|
import applicationGenerator from '../application/application';
|
||||||
import componentGenerator from '../component/component';
|
import componentGenerator from '../component/component';
|
||||||
import libraryGenerator from '../library/library';
|
import libraryGenerator from '../library/library';
|
||||||
@ -133,7 +132,7 @@ export async function createTestUILib(
|
|||||||
let appTree = createTreeWithEmptyWorkspace();
|
let appTree = createTreeWithEmptyWorkspace();
|
||||||
|
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
component: true,
|
component: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -153,7 +152,7 @@ export async function createTestAppLib(
|
|||||||
|
|
||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { readProjectConfiguration, type Tree } from '@nx/devkit';
|
import { readProjectConfiguration, type Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports';
|
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports';
|
||||||
import hostGenerator from '../../generators/host/host';
|
import hostGenerator from '../../generators/host/host';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import updateSsrServerPort from './update-ssr-server-port';
|
import updateSsrServerPort from './update-ssr-server-port';
|
||||||
|
|
||||||
describe('update-19-6-0 update-ssr-server-port migration', () => {
|
describe('update-19-6-0 update-ssr-server-port migration', () => {
|
||||||
@ -17,7 +16,7 @@ describe('update-19-6-0 update-ssr-server-port migration', () => {
|
|||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
ssr: true,
|
ssr: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
remotes: ['product'],
|
remotes: ['product'],
|
||||||
bundler: 'webpack',
|
bundler: 'webpack',
|
||||||
@ -132,7 +131,7 @@ describe('update-19-6-0 update-ssr-server-port migration', () => {
|
|||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
ssr: true,
|
ssr: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
bundler: 'webpack',
|
bundler: 'webpack',
|
||||||
});
|
});
|
||||||
@ -183,7 +182,7 @@ describe('update-19-6-0 update-ssr-server-port migration', () => {
|
|||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
ssr: false,
|
ssr: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
style: 'css',
|
style: 'css',
|
||||||
bundler: 'webpack',
|
bundler: 'webpack',
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { addProjectConfiguration, names, Tree } from '@nx/devkit';
|
import { addProjectConfiguration, names, Tree } from '@nx/devkit';
|
||||||
import applicationGenerator from '../generators/application/application';
|
import applicationGenerator from '../generators/application/application';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
export async function createApp(tree: Tree, appName: string): Promise<any> {
|
export async function createApp(tree: Tree, appName: string): Promise<any> {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import {
|
|||||||
determineProjectNameAndRootOptions,
|
determineProjectNameAndRootOptions,
|
||||||
ensureRootProjectName,
|
ensureRootProjectName,
|
||||||
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';
|
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';
|
||||||
import { type NxRemixGeneratorSchema } from '../schema';
|
import { type NxRemixGeneratorSchema } from '../schema';
|
||||||
|
|
||||||
@ -49,7 +48,7 @@ export async function normalizeOptions(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...options,
|
...options,
|
||||||
linter: options.linter ?? Linter.EsLint,
|
linter: options.linter ?? 'eslint',
|
||||||
projectName: appProjectName,
|
projectName: appProjectName,
|
||||||
projectRoot,
|
projectRoot,
|
||||||
importPath,
|
importPath,
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import {
|
|||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
|
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { libraryGenerator } from '@nx/js';
|
import { libraryGenerator } from '@nx/js';
|
||||||
import { TsConfig } from '../../utils/utilities';
|
import { TsConfig } from '../../utils/utilities';
|
||||||
import { nxVersion, storybookVersion } from '../../utils/versions';
|
import { nxVersion, storybookVersion } from '../../utils/versions';
|
||||||
@ -478,7 +477,7 @@ describe('@nx/storybook:configuration for Storybook v7', () => {
|
|||||||
it("should update the project's .eslintrc.json if config exists", async () => {
|
it("should update the project's .eslintrc.json if config exists", async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'test-ui-lib2',
|
directory: 'test-ui-lib2',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -509,7 +508,7 @@ describe('@nx/storybook:configuration for Storybook v7', () => {
|
|||||||
it('should have the proper typings', async () => {
|
it('should have the proper typings', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'test-ui-lib2',
|
directory: 'test-ui-lib2',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
addPlugin: true,
|
addPlugin: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ import {
|
|||||||
projectIsRootProjectInStandaloneWorkspace,
|
projectIsRootProjectInStandaloneWorkspace,
|
||||||
updateLintConfig,
|
updateLintConfig,
|
||||||
} from './lib/util-functions';
|
} from './lib/util-functions';
|
||||||
import { Linter } from '@nx/eslint';
|
import type { LinterType } from '@nx/eslint';
|
||||||
import {
|
import {
|
||||||
findStorybookAndBuildTargetsAndCompiler,
|
findStorybookAndBuildTargetsAndCompiler,
|
||||||
pleaseUpgrade,
|
pleaseUpgrade,
|
||||||
@ -250,7 +250,7 @@ function normalizeSchema(
|
|||||||
|
|
||||||
const defaults = {
|
const defaults = {
|
||||||
interactionTests: true,
|
interactionTests: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint' as LinterType,
|
||||||
js: false,
|
js: false,
|
||||||
tsConfiguration: true,
|
tsConfiguration: true,
|
||||||
addPlugin,
|
addPlugin,
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import {
|
|||||||
workspaceRoot,
|
workspaceRoot,
|
||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { Linter } from '@nx/eslint';
|
import type { LinterType } from '@nx/eslint';
|
||||||
import { join, relative } from 'path';
|
import { join, relative } from 'path';
|
||||||
import {
|
import {
|
||||||
dedupe,
|
dedupe,
|
||||||
@ -467,7 +467,7 @@ export function normalizeSchema(
|
|||||||
): StorybookConfigureSchema {
|
): StorybookConfigureSchema {
|
||||||
const defaults = {
|
const defaults = {
|
||||||
configureCypress: true,
|
configureCypress: true,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint' as LinterType,
|
||||||
js: false,
|
js: false,
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import {
|
|||||||
updateNxJson,
|
updateNxJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { libraryGenerator } from '@nx/js';
|
import { libraryGenerator } from '@nx/js';
|
||||||
import { cypressProjectGenerator } from './cypress-project';
|
import { cypressProjectGenerator } from './cypress-project';
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ describe('@nx/storybook:cypress-project', () => {
|
|||||||
await cypressProjectGenerator(tree, {
|
await cypressProjectGenerator(tree, {
|
||||||
name: 'test-ui-lib',
|
name: 'test-ui-lib',
|
||||||
directory: 'apps/test-ui-lib-e2e',
|
directory: 'apps/test-ui-lib-e2e',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.exists('apps/test-ui-lib-e2e/cypress.config.ts')).toBeTruthy();
|
expect(tree.exists('apps/test-ui-lib-e2e/cypress.config.ts')).toBeTruthy();
|
||||||
@ -46,7 +45,7 @@ describe('@nx/storybook:cypress-project', () => {
|
|||||||
await cypressProjectGenerator(tree, {
|
await cypressProjectGenerator(tree, {
|
||||||
name: 'test-ui-lib',
|
name: 'test-ui-lib',
|
||||||
directory: 'apps/test-ui-lib-e2e',
|
directory: 'apps/test-ui-lib-e2e',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
const project = readProjectConfiguration(tree, 'test-ui-lib-e2e');
|
const project = readProjectConfiguration(tree, 'test-ui-lib-e2e');
|
||||||
|
|
||||||
@ -64,7 +63,7 @@ describe('@nx/storybook:cypress-project', () => {
|
|||||||
await cypressProjectGenerator(tree, {
|
await cypressProjectGenerator(tree, {
|
||||||
name: 'test-ui-lib',
|
name: 'test-ui-lib',
|
||||||
directory: 'apps/one/two/test-ui-lib-e2e',
|
directory: 'apps/one/two/test-ui-lib-e2e',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
expect(readProjectConfiguration(tree, 'test-ui-lib-e2e')).toBeDefined();
|
expect(readProjectConfiguration(tree, 'test-ui-lib-e2e')).toBeDefined();
|
||||||
expect(
|
expect(
|
||||||
@ -83,7 +82,7 @@ describe('@nx/storybook:cypress-project', () => {
|
|||||||
await cypressProjectGenerator(tree, {
|
await cypressProjectGenerator(tree, {
|
||||||
name: 'test-ui-lib',
|
name: 'test-ui-lib',
|
||||||
directory: 'apps/test-ui-lib-e2e',
|
directory: 'apps/test-ui-lib-e2e',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
|
|
||||||
import { libraryGenerator } from '@nx/js';
|
import { libraryGenerator } from '@nx/js';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
export async function createTestUILibNoNgDevkit(
|
export async function createTestUILibNoNgDevkit(
|
||||||
appTree: Tree,
|
appTree: Tree,
|
||||||
libName: string
|
libName: string
|
||||||
): Promise<Tree> {
|
): Promise<Tree> {
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
Tree,
|
Tree,
|
||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { initGenerator as jsInitGenerator } from '@nx/js';
|
import { initGenerator as jsInitGenerator } from '@nx/js';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
import { normalizeOptions } from './lib/normalize-options';
|
import { normalizeOptions } from './lib/normalize-options';
|
||||||
@ -123,7 +122,7 @@ export async function applicationGeneratorInternal(
|
|||||||
{
|
{
|
||||||
name: options.projectName,
|
name: options.projectName,
|
||||||
projectRoot: options.appProjectRoot,
|
projectRoot: options.appProjectRoot,
|
||||||
linter: options.linter ?? Linter.EsLint,
|
linter: options.linter ?? 'eslint',
|
||||||
unitTestRunner: options.unitTestRunner,
|
unitTestRunner: options.unitTestRunner,
|
||||||
skipPackageJson: options.skipPackageJson,
|
skipPackageJson: options.skipPackageJson,
|
||||||
setParserOptionsProject: options.setParserOptionsProject,
|
setParserOptionsProject: options.setParserOptionsProject,
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import {
|
|||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import { nxVersion } from '../../utils/versions';
|
import { nxVersion } from '../../utils/versions';
|
||||||
import libraryGenerator from './library';
|
import libraryGenerator from './library';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
@ -18,7 +17,7 @@ describe('library', () => {
|
|||||||
|
|
||||||
let defaultSchema: Schema = {
|
let defaultSchema: Schema = {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
unitTestRunner: 'vitest',
|
unitTestRunner: 'vitest',
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { getProjects, Tree, updateProjectConfiguration } from '@nx/devkit';
|
|||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import libraryGenerator from '../../library/library';
|
import libraryGenerator from '../../library/library';
|
||||||
import { createComponentStories } from './component-story';
|
import { createComponentStories } from './component-story';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
|
|
||||||
describe('vue:component-story', () => {
|
describe('vue:component-story', () => {
|
||||||
let appTree: Tree;
|
let appTree: Tree;
|
||||||
@ -112,7 +111,7 @@ export async function createTestUILib(libName: string): Promise<Tree> {
|
|||||||
let appTree = createTreeWithEmptyWorkspace();
|
let appTree = createTreeWithEmptyWorkspace();
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
directory: libName,
|
directory: libName,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
component: true,
|
component: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import applicationGenerator from '../application/application';
|
import applicationGenerator from '../application/application';
|
||||||
import storiesGenerator from './stories';
|
import storiesGenerator from './stories';
|
||||||
|
|
||||||
@ -245,7 +244,7 @@ export async function createTestUIApp(
|
|||||||
|
|
||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { Tree } from '@nx/devkit';
|
import { Tree } from '@nx/devkit';
|
||||||
import storiesGenerator from './stories';
|
import storiesGenerator from './stories';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import libraryGenerator from '../library/library';
|
import libraryGenerator from '../library/library';
|
||||||
|
|
||||||
const componentContent = `<script setup lang="ts">
|
const componentContent = `<script setup lang="ts">
|
||||||
@ -177,7 +176,7 @@ export async function createTestUILib(
|
|||||||
let appTree = createTreeWithEmptyWorkspace();
|
let appTree = createTreeWithEmptyWorkspace();
|
||||||
|
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
component: true,
|
component: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { logger, Tree } from '@nx/devkit';
|
import { logger, Tree } from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import applicationGenerator from '../application/application';
|
import applicationGenerator from '../application/application';
|
||||||
import componentGenerator from '../component/component';
|
import componentGenerator from '../component/component';
|
||||||
import libraryGenerator from '../library/library';
|
import libraryGenerator from '../library/library';
|
||||||
@ -141,7 +140,7 @@ export async function createTestUILib(libName: string): Promise<Tree> {
|
|||||||
let appTree = createTreeWithEmptyWorkspace();
|
let appTree = createTreeWithEmptyWorkspace();
|
||||||
|
|
||||||
await libraryGenerator(appTree, {
|
await libraryGenerator(appTree, {
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
component: true,
|
component: true,
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
skipTsConfig: false,
|
skipTsConfig: false,
|
||||||
@ -159,7 +158,7 @@ export async function createTestAppLib(
|
|||||||
|
|
||||||
await applicationGenerator(appTree, {
|
await applicationGenerator(appTree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export async function addLinting(
|
|||||||
},
|
},
|
||||||
projectType: 'lib' | 'app'
|
projectType: 'lib' | 'app'
|
||||||
) {
|
) {
|
||||||
if (options.linter === Linter.EsLint) {
|
if (options.linter === 'eslint') {
|
||||||
const tasks: GeneratorCallback[] = [];
|
const tasks: GeneratorCallback[] = [];
|
||||||
const lintTask = await lintProjectGenerator(host, {
|
const lintTask = await lintProjectGenerator(host, {
|
||||||
linter: options.linter,
|
linter: options.linter,
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { addProjectConfiguration, names, Tree } from '@nx/devkit';
|
import { addProjectConfiguration, names, Tree } from '@nx/devkit';
|
||||||
import { Linter } from '@nx/eslint';
|
|
||||||
import applicationGenerator from '../generators/application/application';
|
import applicationGenerator from '../generators/application/application';
|
||||||
|
|
||||||
export async function createApp(tree: Tree, appName: string): Promise<any> {
|
export async function createApp(tree: Tree, appName: string): Promise<any> {
|
||||||
await applicationGenerator(tree, {
|
await applicationGenerator(tree, {
|
||||||
e2eTestRunner: 'none',
|
e2eTestRunner: 'none',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
skipFormat: true,
|
skipFormat: true,
|
||||||
style: 'css',
|
style: 'css',
|
||||||
unitTestRunner: 'none',
|
unitTestRunner: 'none',
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import {
|
|||||||
initGenerator as jsInitGenerator,
|
initGenerator as jsInitGenerator,
|
||||||
} from '@nx/js';
|
} from '@nx/js';
|
||||||
import { swcCoreVersion } from '@nx/js/src/utils/versions';
|
import { swcCoreVersion } from '@nx/js/src/utils/versions';
|
||||||
import type { Linter } from '@nx/eslint';
|
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import {
|
import {
|
||||||
nxVersion,
|
nxVersion,
|
||||||
@ -673,7 +672,7 @@ async function normalizeOptions(
|
|||||||
: [];
|
: [];
|
||||||
|
|
||||||
options.style = options.style || 'css';
|
options.style = options.style || 'css';
|
||||||
options.linter = options.linter || ('eslint' as Linter.EsLint);
|
options.linter = options.linter || 'eslint';
|
||||||
options.unitTestRunner = options.unitTestRunner || 'jest';
|
options.unitTestRunner = options.unitTestRunner || 'jest';
|
||||||
options.e2eTestRunner = options.e2eTestRunner || 'playwright';
|
options.e2eTestRunner = options.e2eTestRunner || 'playwright';
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
updateJson,
|
updateJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Linter } from '../../../utils/lint';
|
|
||||||
import { NormalizedSchema } from '../schema';
|
import { NormalizedSchema } from '../schema';
|
||||||
import { updateEslintConfig } from './update-eslint-config';
|
import { updateEslintConfig } from './update-eslint-config';
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ describe('updateEslint', () => {
|
|||||||
it('should handle .eslintrc.json not existing', async () => {
|
it('should handle .eslintrc.json not existing', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
});
|
});
|
||||||
|
|
||||||
const projectConfig = readProjectConfiguration(tree, 'my-lib');
|
const projectConfig = readProjectConfiguration(tree, 'my-lib');
|
||||||
@ -49,7 +48,7 @@ describe('updateEslint', () => {
|
|||||||
it('should update .eslintrc.json extends path when project is moved to subdirectory', async () => {
|
it('should update .eslintrc.json extends path when project is moved to subdirectory', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
// This step is usually handled elsewhere
|
// This step is usually handled elsewhere
|
||||||
tree.rename(
|
tree.rename(
|
||||||
@ -71,7 +70,7 @@ describe('updateEslint', () => {
|
|||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
name: 'api-test',
|
name: 'api-test',
|
||||||
directory: 'api/test',
|
directory: 'api/test',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
// This step is usually handled elsewhere
|
// This step is usually handled elsewhere
|
||||||
tree.rename('api/test/.eslintrc.json', 'test/.eslintrc.json');
|
tree.rename('api/test/.eslintrc.json', 'test/.eslintrc.json');
|
||||||
@ -98,7 +97,7 @@ describe('updateEslint', () => {
|
|||||||
it('should preserve .eslintrc.json non-relative extends when project is moved to subdirectory', async () => {
|
it('should preserve .eslintrc.json non-relative extends when project is moved to subdirectory', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
updateJson(tree, 'my-lib/.eslintrc.json', (eslintRcJson) => {
|
updateJson(tree, 'my-lib/.eslintrc.json', (eslintRcJson) => {
|
||||||
eslintRcJson.extends = [
|
eslintRcJson.extends = [
|
||||||
@ -131,7 +130,7 @@ describe('updateEslint', () => {
|
|||||||
it('should update .eslintrc.json overrides parser project when project is moved', async () => {
|
it('should update .eslintrc.json overrides parser project when project is moved', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
setParserOptionsProject: true,
|
setParserOptionsProject: true,
|
||||||
});
|
});
|
||||||
// This step is usually handled elsewhere
|
// This step is usually handled elsewhere
|
||||||
@ -159,7 +158,7 @@ describe('updateEslint', () => {
|
|||||||
it('should update multiple .eslintrc.json overrides parser project when project is moved', async () => {
|
it('should update multiple .eslintrc.json overrides parser project when project is moved', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
setParserOptionsProject: true,
|
setParserOptionsProject: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -200,7 +199,7 @@ describe('updateEslint', () => {
|
|||||||
it('should update .eslintrc.json parserOptions.project as a string', async () => {
|
it('should update .eslintrc.json parserOptions.project as a string', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
setParserOptionsProject: true,
|
setParserOptionsProject: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -249,7 +248,7 @@ describe('updateEslint (flat config)', () => {
|
|||||||
it('should handle config not existing', async () => {
|
it('should handle config not existing', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.None,
|
linter: 'none',
|
||||||
});
|
});
|
||||||
|
|
||||||
const projectConfig = readProjectConfiguration(tree, 'my-lib');
|
const projectConfig = readProjectConfiguration(tree, 'my-lib');
|
||||||
@ -262,7 +261,7 @@ describe('updateEslint (flat config)', () => {
|
|||||||
it('should update config extends path when project is moved to subdirectory', async () => {
|
it('should update config extends path when project is moved to subdirectory', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
convertToFlat(tree, 'my-lib');
|
convertToFlat(tree, 'my-lib');
|
||||||
// This step is usually handled elsewhere
|
// This step is usually handled elsewhere
|
||||||
@ -283,7 +282,7 @@ describe('updateEslint (flat config)', () => {
|
|||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
name: 'api-test',
|
name: 'api-test',
|
||||||
directory: 'api/test',
|
directory: 'api/test',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
});
|
});
|
||||||
convertToFlat(tree, 'api/test');
|
convertToFlat(tree, 'api/test');
|
||||||
// This step is usually handled elsewhere
|
// This step is usually handled elsewhere
|
||||||
@ -310,7 +309,7 @@ describe('updateEslint (flat config)', () => {
|
|||||||
it('should update config overrides parser project when project is moved', async () => {
|
it('should update config overrides parser project when project is moved', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
setParserOptionsProject: true,
|
setParserOptionsProject: true,
|
||||||
});
|
});
|
||||||
convertToFlat(tree, 'my-lib', { hasParser: true });
|
convertToFlat(tree, 'my-lib', { hasParser: true });
|
||||||
@ -335,7 +334,7 @@ describe('updateEslint (flat config)', () => {
|
|||||||
it('should update multiple config overrides parser project when project is moved', async () => {
|
it('should update multiple config overrides parser project when project is moved', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
setParserOptionsProject: true,
|
setParserOptionsProject: true,
|
||||||
});
|
});
|
||||||
// Add another parser project to eslint.json
|
// Add another parser project to eslint.json
|
||||||
@ -365,7 +364,7 @@ describe('updateEslint (flat config)', () => {
|
|||||||
it('should update config parserOptions.project as a string', async () => {
|
it('should update config parserOptions.project as a string', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
directory: 'my-lib',
|
directory: 'my-lib',
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
setParserOptionsProject: true,
|
setParserOptionsProject: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { readJson, Tree, writeJson } from '@nx/devkit';
|
import { readJson, Tree, writeJson } from '@nx/devkit';
|
||||||
import * as devkit from '@nx/devkit';
|
import * as devkit from '@nx/devkit';
|
||||||
import { createTree } from '@nx/devkit/testing';
|
import { createTree } from '@nx/devkit/testing';
|
||||||
import { Linter } from '../../utils/lint';
|
|
||||||
import {
|
import {
|
||||||
angularCliVersion,
|
angularCliVersion,
|
||||||
nxVersion,
|
nxVersion,
|
||||||
@ -20,7 +19,7 @@ const defaultOptions: Omit<
|
|||||||
> = {
|
> = {
|
||||||
preset: Preset.Apps,
|
preset: Preset.Apps,
|
||||||
skipInstall: false,
|
skipInstall: false,
|
||||||
linter: Linter.EsLint,
|
linter: 'eslint',
|
||||||
defaultBase: 'main',
|
defaultBase: 'main',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user