diff --git a/docs/blog/2024-12-10-tailoring-nx-for-your-organization.md b/docs/blog/2024-12-10-tailoring-nx-for-your-organization.md index ff03d70410..5f69feeca3 100644 --- a/docs/blog/2024-12-10-tailoring-nx-for-your-organization.md +++ b/docs/blog/2024-12-10-tailoring-nx-for-your-organization.md @@ -100,7 +100,7 @@ export async function libraryGenerator( directory, importPath, tags: [`type:${options.type}`, `scope:${shared}`], - linter: Linter.EsLint, + linter: 'eslint', style: 'css', unitTestRunner: 'vitest', }); diff --git a/docs/shared/plugins/organization-specific-plugin.md b/docs/shared/plugins/organization-specific-plugin.md index 5c2688642f..928cdaede7 100644 --- a/docs/shared/plugins/organization-specific-plugin.md +++ b/docs/shared/plugins/organization-specific-plugin.md @@ -53,7 +53,7 @@ export async function libraryGenerator( ) { const callbackAfterFilesUpdated = await reactLibraryGenerator(tree, { ...options, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', unitTestRunner: 'vitest', }); @@ -218,7 +218,7 @@ export async function libraryGenerator( ...options, tags: `scope:${options.scope}`, directory: options.directory || `${options.scope}/${options.name}`, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', unitTestRunner: 'vitest', }); @@ -264,7 +264,7 @@ export async function libraryGenerator( ...options, tags: `scope:${options.scope}`, directory, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', unitTestRunner: 'vitest', }) diff --git a/packages/angular/src/generators/add-linting/add-linting.ts b/packages/angular/src/generators/add-linting/add-linting.ts index d9ea98d460..782b5c94e2 100755 --- a/packages/angular/src/generators/add-linting/add-linting.ts +++ b/packages/angular/src/generators/add-linting/add-linting.ts @@ -6,8 +6,7 @@ import { type Tree, } from '@nx/devkit'; import { camelize, dasherize } from '@nx/devkit/src/utils/string-utils'; -import { Linter, lintProjectGenerator } from '@nx/eslint'; -import type * as eslint from 'eslint'; +import { lintProjectGenerator } from '@nx/eslint'; import { javaScriptOverride, typeScriptOverride, @@ -31,7 +30,7 @@ export async function addLintingGenerator( const tasks: GeneratorCallback[] = []; const rootProject = options.projectRoot === '.' || options.projectRoot === ''; const lintTask = await lintProjectGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', project: options.projectName, tsConfigPaths: [ joinPathFragments(options.projectRoot, 'tsconfig.app.json'), diff --git a/packages/angular/src/generators/application/application.spec.ts b/packages/angular/src/generators/application/application.spec.ts index b6d088dfab..eff2ece063 100644 --- a/packages/angular/src/generators/application/application.spec.ts +++ b/packages/angular/src/generators/application/application.spec.ts @@ -11,7 +11,6 @@ import { updateProjectConfiguration, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import * as enquirer from 'enquirer'; import { backwardCompatibleVersions } from '../../utils/backward-compatible-versions'; import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners'; @@ -573,7 +572,7 @@ describe('app', () => { describe('--linter', () => { describe('eslint', () => { 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) .toMatchInlineSnapshot(` { @@ -583,7 +582,7 @@ describe('app', () => { }); 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); expect(nxJson.plugins).toMatchInlineSnapshot(` @@ -612,7 +611,7 @@ describe('app', () => { it('should not add eslint plugin when no e2e test runner', async () => { await generateApp(appTree, 'my-app', { - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: E2eTestRunner.None, }); @@ -620,7 +619,7 @@ describe('app', () => { }); 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'); expect(eslintConfig).toMatchInlineSnapshot(` @@ -676,7 +675,7 @@ describe('app', () => { describe('none', () => { it('should add no lint target', async () => { - await generateApp(appTree, 'my-app', { linter: Linter.None }); + await generateApp(appTree, 'my-app', { linter: 'none' }); expect( readProjectConfiguration(appTree, 'my-app').targets.lint ).toBeUndefined(); @@ -1426,7 +1425,7 @@ async function generateApp( skipFormat: true, e2eTestRunner: E2eTestRunner.Cypress, unitTestRunner: UnitTestRunner.Jest, - linter: Linter.EsLint, + linter: 'eslint', standalone: false, ...options, }); diff --git a/packages/angular/src/generators/application/lib/add-linting.ts b/packages/angular/src/generators/application/lib/add-linting.ts index 70da0750fd..0ad2439a62 100644 --- a/packages/angular/src/generators/application/lib/add-linting.ts +++ b/packages/angular/src/generators/application/lib/add-linting.ts @@ -1,11 +1,9 @@ import type { Tree } from '@nx/devkit'; import type { NormalizedSchema } from './normalized-schema'; - -import { Linter } from '@nx/eslint'; import addLintingGenerator from '../../add-linting/add-linting'; export async function addLinting(host: Tree, options: NormalizedSchema) { - if (options.linter === Linter.None) { + if (options.linter === 'none') { return; } await addLintingGenerator(host, { diff --git a/packages/angular/src/generators/application/lib/normalize-options.ts b/packages/angular/src/generators/application/lib/normalize-options.ts index e632fd20a6..ad11a6c9ef 100644 --- a/packages/angular/src/generators/application/lib/normalize-options.ts +++ b/packages/angular/src/generators/application/lib/normalize-options.ts @@ -3,7 +3,6 @@ import { determineProjectNameAndRootOptions, ensureRootProjectName, } from '@nx/devkit/src/generators/project-name-and-root-utils'; -import { Linter } from '@nx/eslint'; import { E2eTestRunner, UnitTestRunner } from '../../../utils/test-runners'; import type { Schema } from '../schema'; import type { NormalizedSchema } from './normalized-schema'; @@ -51,7 +50,7 @@ export async function normalizeOptions( skipTests: options.unitTestRunner === UnitTestRunner.None, skipFormat: false, e2eTestRunner: E2eTestRunner.Playwright, - linter: Linter.EsLint, + linter: 'eslint', strict: true, standalone: true, directory: appProjectRoot, diff --git a/packages/angular/src/generators/component-test/component-test.spec.ts b/packages/angular/src/generators/component-test/component-test.spec.ts index 98f602b133..af46f366a7 100644 --- a/packages/angular/src/generators/component-test/component-test.spec.ts +++ b/packages/angular/src/generators/component-test/component-test.spec.ts @@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { assertMinimumCypressVersion } from '@nx/cypress/src/utils/versions'; import { Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { UnitTestRunner } from '../../utils/test-runners'; import { componentGenerator } from '../component/component'; import { generateTestLibrary } from '../utils/testing'; @@ -28,7 +27,7 @@ describe('Angular Cypress Component Test Generator', () => { await generateTestLibrary(tree, { directory: 'my-lib', unitTestRunner: UnitTestRunner.None, - linter: Linter.None, + linter: 'none', skipFormat: true, }); await componentGenerator(tree, { @@ -52,7 +51,7 @@ describe('Angular Cypress Component Test Generator', () => { await generateTestLibrary(tree, { directory: 'my-lib', unitTestRunner: UnitTestRunner.None, - linter: Linter.None, + linter: 'none', skipFormat: true, }); await componentGenerator(tree, { @@ -106,7 +105,7 @@ export class MyLibComponent implements OnInit { await generateTestLibrary(tree, { directory: 'my-lib', unitTestRunner: UnitTestRunner.None, - linter: Linter.None, + linter: 'none', skipFormat: true, }); await componentGenerator(tree, { @@ -159,7 +158,7 @@ export class MyLibComponent implements OnInit { await generateTestLibrary(tree, { directory: 'my-lib', unitTestRunner: UnitTestRunner.None, - linter: Linter.None, + linter: 'none', skipFormat: true, }); @@ -190,7 +189,7 @@ export class MyLibComponent implements OnInit { await generateTestLibrary(tree, { directory: 'my-lib', unitTestRunner: UnitTestRunner.None, - linter: Linter.None, + linter: 'none', skipFormat: true, }); diff --git a/packages/angular/src/generators/federate-module/federate-module.spec.ts b/packages/angular/src/generators/federate-module/federate-module.spec.ts index 581d4673cf..70c85c0652 100644 --- a/packages/angular/src/generators/federate-module/federate-module.spec.ts +++ b/packages/angular/src/generators/federate-module/federate-module.spec.ts @@ -5,7 +5,6 @@ import { Schema } from './schema'; import { Schema as remoteSchma } from '../remote/schema'; import { federateModuleGenerator } from './federate-module'; import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports'; -import { Linter } from '@nx/eslint'; import remoteGenerator from '../remote/remote'; import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners'; @@ -57,7 +56,7 @@ describe('federate-module', () => { directory: 'myremote', e2eTestRunner: E2eTestRunner.Cypress, skipFormat: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', unitTestRunner: UnitTestRunner.Jest, }; diff --git a/packages/angular/src/generators/host/host.spec.ts b/packages/angular/src/generators/host/host.spec.ts index fef21ca90d..5a6455b53e 100644 --- a/packages/angular/src/generators/host/host.spec.ts +++ b/packages/angular/src/generators/host/host.spec.ts @@ -11,7 +11,6 @@ import { generateTestHostApplication, generateTestRemoteApplication, } from '../utils/testing'; -import { Linter } from '@nx/eslint'; describe('Host App Generator', () => { it('should generate a host app with no remotes', async () => { @@ -550,7 +549,7 @@ describe('Host App Generator', () => { remotes: [remote], dynamic: true, e2eTestRunner: E2eTestRunner.None, - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: UnitTestRunner.None, typescriptConfiguration: false, diff --git a/packages/angular/src/generators/library/lib/normalize-options.ts b/packages/angular/src/generators/library/lib/normalize-options.ts index 82ce5124dc..b9da4e4782 100644 --- a/packages/angular/src/generators/library/lib/normalize-options.ts +++ b/packages/angular/src/generators/library/lib/normalize-options.ts @@ -3,7 +3,6 @@ import { determineProjectNameAndRootOptions, ensureRootProjectName, } from '@nx/devkit/src/generators/project-name-and-root-utils'; -import { Linter } from '@nx/eslint'; import { UnitTestRunner } from '../../../utils/test-runners'; import { Schema } from '../schema'; import { NormalizedSchema } from './normalized-schema'; @@ -16,7 +15,7 @@ export async function normalizeOptions( // Create a schema with populated default values const options: Schema = { buildable: false, - linter: Linter.EsLint, + linter: 'eslint', publishable: false, simpleName: false, skipFormat: false, @@ -55,7 +54,7 @@ export async function normalizeOptions( const ngCliSchematicLibRoot = projectName; const allNormalizedOptions = { ...options, - linter: options.linter ?? Linter.EsLint, + linter: options.linter ?? 'eslint', unitTestRunner: options.unitTestRunner ?? UnitTestRunner.Jest, prefix: options.prefix ?? 'lib', name: projectName, diff --git a/packages/angular/src/generators/library/library.spec.ts b/packages/angular/src/generators/library/library.spec.ts index 80a2404ca4..d1315931af 100644 --- a/packages/angular/src/generators/library/library.spec.ts +++ b/packages/angular/src/generators/library/library.spec.ts @@ -11,7 +11,6 @@ import { updateJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { createApp } from '../../utils/nx-devkit/testing'; import { UnitTestRunner } from '../../utils/test-runners'; import { @@ -40,7 +39,7 @@ describe('lib', () => { directory: 'my-lib', publishable: false, buildable: false, - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, unitTestRunner: UnitTestRunner.Jest, simpleName: false, @@ -1205,7 +1204,7 @@ describe('lib', () => { it('should add valid eslint JSON configuration which extends from Nx presets (flat config)', async () => { 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'); expect(eslintConfig).toMatchInlineSnapshot(` @@ -1253,7 +1252,7 @@ describe('lib', () => { it('should add valid eslint JSON configuration which extends from Nx presets (eslintrc)', async () => { // ACT - await runLibraryGeneratorWithOpts({ linter: Linter.EsLint }); + await runLibraryGeneratorWithOpts({ linter: 'eslint' }); // ASSERT @@ -1311,7 +1310,7 @@ describe('lib', () => { it('should add dependency checks to buildable libs', async () => { // ACT await runLibraryGeneratorWithOpts({ - linter: Linter.EsLint, + linter: 'eslint', buildable: true, }); @@ -1388,7 +1387,7 @@ describe('lib', () => { describe('none', () => { it('should not add an architect target for lint', async () => { // ACT - await runLibraryGeneratorWithOpts({ linter: Linter.None }); + await runLibraryGeneratorWithOpts({ linter: 'none' }); // ASSERT expect( diff --git a/packages/angular/src/generators/library/library.ts b/packages/angular/src/generators/library/library.ts index 239898adf9..37b064af18 100644 --- a/packages/angular/src/generators/library/library.ts +++ b/packages/angular/src/generators/library/library.ts @@ -6,7 +6,6 @@ import { joinPathFragments, Tree, } from '@nx/devkit'; -import { Linter } from '@nx/eslint'; import { addTsConfigPath, initGenerator as jsInitGenerator } from '@nx/js'; import init from '../../generators/init/init'; import addLintingGenerator from '../add-linting/add-linting'; @@ -180,7 +179,7 @@ async function addLinting( host: Tree, options: NormalizedSchema['libraryOptions'] ) { - if (options.linter === Linter.None) { + if (options.linter === 'none') { return; } await addLintingGenerator(host, { diff --git a/packages/angular/src/generators/move/move.spec.ts b/packages/angular/src/generators/move/move.spec.ts index 629355f2fd..62f5f32b42 100644 --- a/packages/angular/src/generators/move/move.spec.ts +++ b/packages/angular/src/generators/move/move.spec.ts @@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import * as devkit from '@nx/devkit'; import { ProjectGraph, readJson, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { UnitTestRunner } from '../../utils/test-runners'; import { librarySecondaryEntryPointGenerator } from '../library-secondary-entry-point/library-secondary-entry-point'; import { generateTestLibrary } from '../utils/testing'; @@ -36,7 +35,7 @@ describe('@nx/angular:move', () => { await generateTestLibrary(tree, { directory: 'my-lib', buildable: false, - linter: Linter.EsLint, + linter: 'eslint', publishable: false, simpleName: true, skipFormat: true, @@ -132,7 +131,7 @@ describe('@nx/angular:move', () => { await generateTestLibrary(tree, { directory: 'my-lib2', buildable: false, - linter: Linter.EsLint, + linter: 'eslint', publishable: false, simpleName: true, skipFormat: true, @@ -259,7 +258,7 @@ describe('@nx/angular:move', () => { await generateTestLibrary(tree, { directory: 'my-importer', buildable: false, - linter: Linter.EsLint, + linter: 'eslint', publishable: false, simpleName: true, skipFormat: true, @@ -342,7 +341,7 @@ describe('@nx/angular:move', () => { await generateTestLibrary(tree, { directory: 'my-lib-demo', buildable: false, - linter: Linter.EsLint, + linter: 'eslint', publishable: false, simpleName: true, skipFormat: true, diff --git a/packages/angular/src/generators/ng-add/migrators/projects/e2e.migrator.ts b/packages/angular/src/generators/ng-add/migrators/projects/e2e.migrator.ts index 3cea0153af..f5d5b9f7a1 100644 --- a/packages/angular/src/generators/ng-add/migrators/projects/e2e.migrator.ts +++ b/packages/angular/src/generators/ng-add/migrators/projects/e2e.migrator.ts @@ -16,7 +16,7 @@ import { updateProjectConfiguration, writeJson, } from '@nx/devkit'; -import { Linter, lintProjectGenerator } from '@nx/eslint'; +import { lintProjectGenerator } from '@nx/eslint'; import { getRootTsConfigPathInTree, insertImport } from '@nx/js'; import { ensureTypescript } from '@nx/js/src/utils/typescript/ensure-typescript'; import { basename, relative } from 'path'; @@ -317,7 +317,7 @@ export class E2eMigrator extends ProjectMigrator { if (this.isProjectUsingEsLint) { await lintProjectGenerator(this.tree, { project: this.project.name, - linter: Linter.EsLint, + linter: 'eslint', unitTestRunner: this.options.unitTestRunner, tsConfigPaths: [ joinPathFragments(this.project.newRoot, 'tsconfig.json'), @@ -347,7 +347,7 @@ export class E2eMigrator extends ProjectMigrator { ); await configurationGenerator(this.tree, { project: this.project.name, - linter: this.isProjectUsingEsLint ? Linter.EsLint : Linter.None, + linter: this.isProjectUsingEsLint ? 'eslint' : 'none', skipFormat: true, // any target would do, we replace it later with the target existing in the project being migrated devServerTarget: `${this.appName}:serve`, diff --git a/packages/angular/src/generators/storybook-configuration/storybook-configuration.spec.ts b/packages/angular/src/generators/storybook-configuration/storybook-configuration.spec.ts index 4349c2d761..a2f4458ed4 100644 --- a/packages/angular/src/generators/storybook-configuration/storybook-configuration.spec.ts +++ b/packages/angular/src/generators/storybook-configuration/storybook-configuration.spec.ts @@ -1,6 +1,5 @@ import type { Tree } from '@nx/devkit'; import { readJson, writeJson } from '@nx/devkit'; -import { Linter } from '@nx/eslint/src/generators/utils/linter'; import { componentGenerator } from '../component/component'; import { librarySecondaryEntryPointGenerator } from '../library-secondary-entry-point/library-secondary-entry-point'; import { @@ -64,7 +63,7 @@ describe('StorybookConfiguration generator', () => { await storybookConfigurationGenerator(tree, { project: libName, generateStories: false, - linter: Linter.None, + linter: 'none', skipFormat: true, }); @@ -192,7 +191,7 @@ describe('StorybookConfiguration generator', () => { project: 'test-app', generateStories: false, skipFormat: true, - linter: Linter.EsLint, + linter: 'eslint', }); const tsConfig = readJson(tree, 'test-app/tsconfig.editor.json'); diff --git a/packages/angular/src/generators/utils/testing.ts b/packages/angular/src/generators/utils/testing.ts index 04c2723d7f..42d1512501 100644 --- a/packages/angular/src/generators/utils/testing.ts +++ b/packages/angular/src/generators/utils/testing.ts @@ -1,7 +1,6 @@ import type { Tree } from '@nx/devkit'; import { names, readProjectConfiguration } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { UnitTestRunner } from '../../utils/test-runners'; import { applicationGenerator } from '../application/application'; import type { Schema as ApplicationOptions } from '../application/schema'; @@ -58,7 +57,7 @@ export async function createStorybookTestWorkspaceForLib( await libraryGenerator(tree, { directory: libName, buildable: false, - linter: Linter.EsLint, + linter: 'eslint', publishable: false, simpleName: false, skipFormat: true, diff --git a/packages/cypress/src/utils/add-linter.ts b/packages/cypress/src/utils/add-linter.ts index 3e7607fc75..a9cf9f6189 100644 --- a/packages/cypress/src/utils/add-linter.ts +++ b/packages/cypress/src/utils/add-linter.ts @@ -47,7 +47,7 @@ export async function addLinterToCyProject( tree: Tree, options: CyLinterOptions ) { - if (options.linter === Linter.None) { + if (options.linter === 'none') { 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); } diff --git a/packages/detox/src/generators/application/application.spec.ts b/packages/detox/src/generators/application/application.spec.ts index 49f5513b14..d5ad98e630 100644 --- a/packages/detox/src/generators/application/application.spec.ts +++ b/packages/detox/src/generators/application/application.spec.ts @@ -9,7 +9,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint/src/generators/utils/linter'; import detoxApplicationGenerator from './application'; @@ -30,7 +29,7 @@ describe('detox application generator', () => { await detoxApplicationGenerator(tree, { e2eDirectory: 'my-app-e2e', appProject: 'my-app', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, }); @@ -101,7 +100,7 @@ describe('detox application generator', () => { e2eName: 'my-app-e2e', e2eDirectory: 'my-dir', appProject: 'my-dir-my-app', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, }); @@ -172,7 +171,7 @@ describe('detox application generator', () => { e2eName: 'my-app-e2e', e2eDirectory: 'e2e-dir', appProject: 'my-dir-my-app', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, }); @@ -242,7 +241,7 @@ describe('detox application generator', () => { await detoxApplicationGenerator(tree, { e2eDirectory: 'my-dir/my-app-e2e', appProject: 'my-dir-my-app', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, }); @@ -334,7 +333,7 @@ describe('detox application generator', () => { await detoxApplicationGenerator(tree, { e2eDirectory: 'my-dir/my-app-e2e', appProject: 'my-dir-my-app', - linter: Linter.None, + linter: 'none', framework: 'expo', addPlugin: true, }); @@ -416,7 +415,7 @@ describe('detox application generator', () => { await detoxApplicationGenerator(tree, { e2eDirectory: 'my-app-e2e', appProject: 'my-app', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, }); @@ -461,7 +460,7 @@ describe('detox application generator', () => { await detoxApplicationGenerator(tree, { e2eDirectory: 'my-app-e2e', appProject: 'my-app', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, }); @@ -528,7 +527,7 @@ describe('detox application generator', () => { await detoxApplicationGenerator(tree, { e2eDirectory: 'apps/my-app-e2e', appProject: 'my-app', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, useProjectJson: false, @@ -589,7 +588,7 @@ describe('detox application generator', () => { await detoxApplicationGenerator(tree, { e2eDirectory: 'apps/my-app-e2e', appProject: 'my-app', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, skipFormat: true, @@ -670,7 +669,7 @@ describe('detox application generator', () => { e2eDirectory: 'apps/my-app-e2e', appProject: 'my-app', e2eName: 'my-app-e2e', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, skipFormat: true, @@ -698,7 +697,7 @@ describe('detox application generator', () => { e2eDirectory: 'apps/my-app-e2e', appProject: 'my-app', e2eName: 'my-app-e2e', - linter: Linter.None, + linter: 'none', framework: 'react-native', addPlugin: true, skipFormat: true, diff --git a/packages/detox/src/generators/application/lib/add-linting.spec.ts b/packages/detox/src/generators/application/lib/add-linting.spec.ts index 3f60572a84..eea299edc1 100644 --- a/packages/detox/src/generators/application/lib/add-linting.spec.ts +++ b/packages/detox/src/generators/application/lib/add-linting.spec.ts @@ -1,6 +1,5 @@ import { readProjectConfiguration, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { addLinting } from './add-linting'; import { addProject } from './add-project'; @@ -20,7 +19,7 @@ describe('Add Linting', () => { appDisplayName: 'MyApp', appExpoName: 'MyApp', appRoot: 'apps/my-app', - linter: Linter.EsLint, + linter: 'eslint', isUsingTsSolutionConfig: false, framework: 'react-native', }); @@ -38,7 +37,7 @@ describe('Add Linting', () => { appDisplayName: 'MyApp', appExpoName: 'MyApp', appRoot: 'apps/my-app', - linter: Linter.EsLint, + linter: 'eslint', isUsingTsSolutionConfig: false, framework: 'react-native', }); @@ -58,7 +57,7 @@ describe('Add Linting', () => { appDisplayName: 'MyApp', appExpoName: 'MyApp', appRoot: 'apps/my-app', - linter: Linter.None, + linter: 'none', isUsingTsSolutionConfig: false, framework: 'react-native', }); diff --git a/packages/detox/src/generators/application/lib/add-linting.ts b/packages/detox/src/generators/application/lib/add-linting.ts index d578ced9ca..85e6424ce2 100644 --- a/packages/detox/src/generators/application/lib/add-linting.ts +++ b/packages/detox/src/generators/application/lib/add-linting.ts @@ -1,4 +1,4 @@ -import { Linter, lintProjectGenerator } from '@nx/eslint'; +import { lintProjectGenerator } from '@nx/eslint'; import { addDependenciesToPackageJson, GeneratorCallback, @@ -17,7 +17,7 @@ import { import { useFlatConfig } from '@nx/eslint/src/utils/flat-config'; export async function addLinting(host: Tree, options: NormalizedSchema) { - if (options.linter === Linter.None) { + if (options.linter === 'none') { return () => {}; } diff --git a/packages/detox/src/generators/application/lib/add-project.spec.ts b/packages/detox/src/generators/application/lib/add-project.spec.ts index 177c048614..0b03de9a14 100644 --- a/packages/detox/src/generators/application/lib/add-project.spec.ts +++ b/packages/detox/src/generators/application/lib/add-project.spec.ts @@ -4,7 +4,6 @@ import { Tree, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { addProject } from './add-project'; describe('Add Project', () => { @@ -39,7 +38,7 @@ describe('Add Project', () => { appDisplayName: 'MyApp', appExpoName: 'MyApp', appRoot: 'apps/my-app', - linter: Linter.EsLint, + linter: 'eslint', framework: 'react-native', useProjectJson: true, }); @@ -90,7 +89,7 @@ describe('Add Project', () => { appDisplayName: 'MyApp', appExpoName: 'MyApp', appRoot: 'apps/my-dir/my-app', - linter: Linter.EsLint, + linter: 'eslint', framework: 'react-native', useProjectJson: true, }); diff --git a/packages/detox/src/generators/application/lib/create-files.spec.ts b/packages/detox/src/generators/application/lib/create-files.spec.ts index 8ba30d5129..2d52d55315 100644 --- a/packages/detox/src/generators/application/lib/create-files.spec.ts +++ b/packages/detox/src/generators/application/lib/create-files.spec.ts @@ -1,6 +1,5 @@ import { Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { createFiles } from './create-files'; describe('Create Files', () => { @@ -22,7 +21,7 @@ describe('Create Files', () => { appDisplayName: 'MyApp', appExpoName: 'MyApp', appRoot: 'apps/my-app', - linter: Linter.EsLint, + linter: 'eslint', framework: 'react-native', }); diff --git a/packages/detox/src/generators/application/lib/normalize-options.spec.ts b/packages/detox/src/generators/application/lib/normalize-options.spec.ts index 8efa3033dc..3873d1189f 100644 --- a/packages/detox/src/generators/application/lib/normalize-options.spec.ts +++ b/packages/detox/src/generators/application/lib/normalize-options.spec.ts @@ -1,6 +1,5 @@ import { addProjectConfiguration, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { Schema } from '../schema'; import { normalizeOptions } from './normalize-options'; @@ -21,7 +20,7 @@ describe('Normalize Options', () => { framework: 'react-native', e2eDirectory: 'apps/my-app-e2e', appProject: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', }; const options = await normalizeOptions(appTree, schema); expect(options).toEqual({ @@ -38,7 +37,7 @@ describe('Normalize Options', () => { appExpoName: 'MyApp', appRoot: 'apps/my-app', isUsingTsSolutionConfig: false, - linter: Linter.EsLint, + linter: 'eslint', js: false, useProjectJson: true, }); diff --git a/packages/eslint/src/generators/convert-to-flat-config/generator.spec.ts b/packages/eslint/src/generators/convert-to-flat-config/generator.spec.ts index a42d7418bd..12b767acc1 100644 --- a/packages/eslint/src/generators/convert-to-flat-config/generator.spec.ts +++ b/packages/eslint/src/generators/convert-to-flat-config/generator.spec.ts @@ -13,7 +13,6 @@ import { import { convertToFlatConfigGenerator } from './generator'; import { ConvertToFlatConfigGeneratorSchema } from './schema'; import { lintProjectGenerator } from '../lint-project/lint-project'; -import { Linter } from '../utils/linter'; import { eslintrcVersion } from '../../utils/versions'; import { dump } from '@zkochan/js-yaml'; @@ -54,7 +53,7 @@ describe('convert-to-flat-config generator', () => { it('should update dependencies', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, }); @@ -80,7 +79,7 @@ describe('convert-to-flat-config generator', () => { it('should convert json successfully', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -106,7 +105,7 @@ describe('convert-to-flat-config generator', () => { it('should convert yaml successfully', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', eslintFilePatterns: ['**/*.ts'], project: 'test-lib', setParserOptionsProject: false, @@ -137,7 +136,7 @@ describe('convert-to-flat-config generator', () => { it('should convert yml successfully', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', eslintFilePatterns: ['**/*.ts'], project: 'test-lib', setParserOptionsProject: false, @@ -168,7 +167,7 @@ describe('convert-to-flat-config generator', () => { it('should add plugin extends', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -273,7 +272,7 @@ describe('convert-to-flat-config generator', () => { it('should add global eslintignores', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, }); @@ -289,7 +288,7 @@ describe('convert-to-flat-config generator', () => { it('should handle custom eslintignores', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -319,7 +318,7 @@ describe('convert-to-flat-config generator', () => { it('should add settings', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -338,7 +337,7 @@ describe('convert-to-flat-config generator', () => { it('should add env configuration', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -358,7 +357,7 @@ describe('convert-to-flat-config generator', () => { it('should add global configuration', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -377,7 +376,7 @@ describe('convert-to-flat-config generator', () => { it('should add global and env configuration', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -399,7 +398,7 @@ describe('convert-to-flat-config generator', () => { it('should add plugins', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -421,7 +420,7 @@ describe('convert-to-flat-config generator', () => { it('should add parser', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -438,7 +437,7 @@ describe('convert-to-flat-config generator', () => { it('should add linter options', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, 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 () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, 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 () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'cjs', @@ -586,7 +585,7 @@ describe('convert-to-flat-config generator', () => { }); await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'dx-assets-ui', setParserOptionsProject: false, @@ -666,7 +665,7 @@ describe('convert-to-flat-config generator', () => { it('should update dependencies', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -693,7 +692,7 @@ describe('convert-to-flat-config generator', () => { it('should convert json successfully', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -719,7 +718,7 @@ describe('convert-to-flat-config generator', () => { it('should convert yaml successfully', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', eslintFilePatterns: ['**/*.ts'], project: 'test-lib', setParserOptionsProject: false, @@ -750,7 +749,7 @@ describe('convert-to-flat-config generator', () => { it('should convert yml successfully', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', eslintFilePatterns: ['**/*.ts'], project: 'test-lib', setParserOptionsProject: false, @@ -781,7 +780,7 @@ describe('convert-to-flat-config generator', () => { it('should add plugin extends', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -888,7 +887,7 @@ describe('convert-to-flat-config generator', () => { it('should add global eslintignores', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, }); @@ -904,7 +903,7 @@ describe('convert-to-flat-config generator', () => { it('should handle custom eslintignores', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -934,7 +933,7 @@ describe('convert-to-flat-config generator', () => { it('should add settings', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -953,7 +952,7 @@ describe('convert-to-flat-config generator', () => { it('should add env configuration', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -973,7 +972,7 @@ describe('convert-to-flat-config generator', () => { it('should add global configuration', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -992,7 +991,7 @@ describe('convert-to-flat-config generator', () => { it('should add global and env configuration', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -1014,7 +1013,7 @@ describe('convert-to-flat-config generator', () => { it('should add plugins', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -1036,7 +1035,7 @@ describe('convert-to-flat-config generator', () => { it('should add parser', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -1053,7 +1052,7 @@ describe('convert-to-flat-config generator', () => { it('should add linter options', async () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, 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 () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, 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 () => { await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, eslintConfigFormat: 'mjs', @@ -1203,7 +1202,7 @@ describe('convert-to-flat-config generator', () => { }); await lintProjectGenerator(tree, { skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', project: 'dx-assets-ui', setParserOptionsProject: false, diff --git a/packages/eslint/src/generators/lint-project/lint-project-convert-monorepo.spec.ts b/packages/eslint/src/generators/lint-project/lint-project-convert-monorepo.spec.ts index 5ff5f556f3..1d72bb2cd1 100644 --- a/packages/eslint/src/generators/lint-project/lint-project-convert-monorepo.spec.ts +++ b/packages/eslint/src/generators/lint-project/lint-project-convert-monorepo.spec.ts @@ -5,7 +5,6 @@ import { Tree, } from '@nx/devkit'; -import { Linter } from '../utils/linter'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { lintProjectGenerator } from './lint-project'; @@ -78,7 +77,7 @@ describe('@nx/eslint:lint-project (convert to monorepo style)', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'nestedpkg', setParserOptionsProject: false, }); diff --git a/packages/eslint/src/generators/lint-project/lint-project.spec.ts b/packages/eslint/src/generators/lint-project/lint-project.spec.ts index e815da6627..b030786844 100644 --- a/packages/eslint/src/generators/lint-project/lint-project.spec.ts +++ b/packages/eslint/src/generators/lint-project/lint-project.spec.ts @@ -8,7 +8,6 @@ import { updateJson, } from '@nx/devkit'; -import { Linter } from '../utils/linter'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { lintProjectGenerator } from './lint-project'; @@ -52,7 +51,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -80,7 +79,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -108,7 +107,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -137,7 +136,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -167,7 +166,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -195,7 +194,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -223,7 +222,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -252,7 +251,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -277,7 +276,7 @@ describe('@nx/eslint:lint-project', () => { process.env.ESLINT_USE_FLAT_CONFIG = 'true'; await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -348,7 +347,7 @@ describe('@nx/eslint:lint-project', () => { process.env.ESLINT_USE_FLAT_CONFIG = 'true'; await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, skipFormat: true, @@ -417,7 +416,7 @@ describe('@nx/eslint:lint-project', () => { it('should generate a eslint config (legacy)', async () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, }); @@ -449,7 +448,7 @@ describe('@nx/eslint:lint-project', () => { it('should generate a project config with lintFilePatterns if provided', async () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', eslintFilePatterns: ['libs/test-lib/src/**/*.ts'], setParserOptionsProject: false, @@ -466,7 +465,7 @@ describe('@nx/eslint:lint-project', () => { it('should generate a eslint config for buildable library', async () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'buildable-lib', 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 () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'buildable-lib', setParserOptionsProject: false, eslintFilePatterns: ['libs/test-lib/src/**/*.ts'], @@ -532,7 +531,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', setParserOptionsProject: false, }); @@ -570,7 +569,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'buildable-lib', setParserOptionsProject: false, }); @@ -593,7 +592,7 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'buildable-lib', setParserOptionsProject: false, }); @@ -606,7 +605,7 @@ describe('@nx/eslint:lint-project', () => { it('should extend root config', async () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', eslintFilePatterns: ['libs/test-lib/**/*.ts'], project: 'test-lib', setParserOptionsProject: false, @@ -619,7 +618,7 @@ describe('@nx/eslint:lint-project', () => { it('should not extend root config if rootProject is set', async () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', eslintFilePatterns: ['libs/test-lib/**/*.ts'], project: 'test-lib', setParserOptionsProject: false, @@ -633,7 +632,7 @@ describe('@nx/eslint:lint-project', () => { it('should generate the global eslint config', async () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'test-lib', }); @@ -695,13 +694,13 @@ describe('@nx/eslint:lint-project', () => { await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'explicit-lib', addExplicitTargets: true, }); await lintProjectGenerator(tree, { ...defaultOptions, - linter: Linter.EsLint, + linter: 'eslint', project: 'inferred-lib', addExplicitTargets: false, }); diff --git a/packages/eslint/src/generators/utils/linter.ts b/packages/eslint/src/generators/utils/linter.ts index cb5628aa9d..c47cccc738 100644 --- a/packages/eslint/src/generators/utils/linter.ts +++ b/packages/eslint/src/generators/utils/linter.ts @@ -1,5 +1,5 @@ -/* - * @deprecated Use LinterType instead +/** + * @deprecated Use LinterType instead. It will be removed in Nx v22. */ export enum Linter { EsLint = 'eslint', diff --git a/packages/expo/src/generators/application/application.spec.ts b/packages/expo/src/generators/application/application.spec.ts index 472306e124..06caded598 100644 --- a/packages/expo/src/generators/application/application.spec.ts +++ b/packages/expo/src/generators/application/application.spec.ts @@ -9,7 +9,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { expoApplicationGenerator } from './application'; describe('app', () => { @@ -24,7 +23,7 @@ describe('app', () => { await expoApplicationGenerator(appTree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: false, @@ -40,7 +39,7 @@ describe('app', () => { directory: 'my-app', displayName: 'myApp', tags: 'one,two', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: false, @@ -57,7 +56,7 @@ describe('app', () => { await expoApplicationGenerator(appTree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: false, @@ -76,7 +75,7 @@ describe('app', () => { await expoApplicationGenerator(appTree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: true, @@ -96,7 +95,7 @@ describe('app', () => { await expoApplicationGenerator(appTree, { name: 'my-app', directory: 'my-dir', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'detox', js: false, skipFormat: false, @@ -157,7 +156,7 @@ describe('app', () => { it('should create e2e app without directory', async () => { await expoApplicationGenerator(appTree, { directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'detox', js: false, skipFormat: false, @@ -218,7 +217,7 @@ describe('app', () => { await expoApplicationGenerator(appTree, { directory: 'my-app', displayName: 'my app name', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'detox', js: false, skipFormat: false, @@ -306,7 +305,7 @@ describe('app', () => { await expoApplicationGenerator(tree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: false, @@ -436,7 +435,7 @@ describe('app', () => { directory: 'my-app', name: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: false, @@ -462,7 +461,7 @@ describe('app', () => { it('should generate project.json if useProjectJson is true', async () => { await expoApplicationGenerator(tree, { directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'cypress', useProjectJson: true, unitTestRunner: 'none', diff --git a/packages/expo/src/generators/application/lib/normalize-options.spec.ts b/packages/expo/src/generators/application/lib/normalize-options.spec.ts index 4a54588521..81c985e525 100644 --- a/packages/expo/src/generators/application/lib/normalize-options.spec.ts +++ b/packages/expo/src/generators/application/lib/normalize-options.spec.ts @@ -1,6 +1,5 @@ import { Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { Schema } from '../schema'; import { NormalizedSchema, normalizeOptions } from './normalize-options'; @@ -14,7 +13,7 @@ describe('Normalize Options', () => { it('should normalize options with name in kebab case', async () => { const schema: Schema = { directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: true, @@ -31,7 +30,7 @@ describe('Normalize Options', () => { simpleName: 'my-app', parsedTags: [], projectName: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', importPath: '@proj/my-app', unitTestRunner: 'jest', @@ -48,7 +47,7 @@ describe('Normalize Options', () => { it('should normalize options with name in camel case', async () => { const schema: Schema = { directory: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: true, @@ -65,7 +64,7 @@ describe('Normalize Options', () => { simpleName: 'myApp', parsedTags: [], projectName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', importPath: '@proj/myApp', skipFormat: false, @@ -83,7 +82,7 @@ describe('Normalize Options', () => { const schema: Schema = { name: 'my-app', directory: 'directory', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: true, @@ -104,7 +103,7 @@ describe('Normalize Options', () => { e2eTestRunner: 'none', importPath: '@proj/my-app', unitTestRunner: 'jest', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, js: true, rootProject: false, @@ -118,7 +117,7 @@ describe('Normalize Options', () => { it('should normalize options that has directory in its name', async () => { const schema: Schema = { directory: 'directory/my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: true, @@ -138,7 +137,7 @@ describe('Normalize Options', () => { e2eTestRunner: 'none', importPath: '@proj/my-app', unitTestRunner: 'jest', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, js: true, rootProject: false, @@ -153,7 +152,7 @@ describe('Normalize Options', () => { const schema: Schema = { directory: 'my-app', displayName: 'My App', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: true, @@ -173,7 +172,7 @@ describe('Normalize Options', () => { e2eTestRunner: 'none', importPath: '@proj/my-app', unitTestRunner: 'jest', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, js: true, rootProject: false, diff --git a/packages/expo/src/generators/component/component.spec.ts b/packages/expo/src/generators/component/component.spec.ts index 799b5ddf5b..f8e53ea182 100644 --- a/packages/expo/src/generators/component/component.spec.ts +++ b/packages/expo/src/generators/component/component.spec.ts @@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { logger, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import expoApplicationGenerator from '../application/application'; import expoLibraryGenerator from '../library/library'; import { expoComponentGenerator } from './component'; @@ -29,7 +28,7 @@ describe('component', () => { await expoApplicationGenerator(appTree, { directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', skipFormat: false, js: true, @@ -37,7 +36,7 @@ describe('component', () => { }); await expoLibraryGenerator(appTree, { directory: projectName, - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', diff --git a/packages/expo/src/generators/library/library.spec.ts b/packages/expo/src/generators/library/library.spec.ts index 4264f445c0..441b557be1 100644 --- a/packages/expo/src/generators/library/library.spec.ts +++ b/packages/expo/src/generators/library/library.spec.ts @@ -1,7 +1,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { - getProjects, readJson, readProjectConfiguration, Tree, @@ -9,7 +8,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { hasPlugin as hasRollupPlugin } from '@nx/rollup/src/utils/has-plugin'; import { expoLibraryGenerator } from './library'; import { Schema } from './schema'; @@ -19,7 +17,7 @@ describe('lib', () => { const defaultSchema: Schema = { directory: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', diff --git a/packages/expo/src/utils/add-linting.spec.ts b/packages/expo/src/utils/add-linting.spec.ts index 213d72aacf..5c8089f3d3 100644 --- a/packages/expo/src/utils/add-linting.spec.ts +++ b/packages/expo/src/utils/add-linting.spec.ts @@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { libraryGenerator } from '@nx/js'; import { addLinting } from './add-linting'; @@ -13,14 +12,14 @@ describe('Add Linting', () => { tree = createTreeWithEmptyWorkspace(); await libraryGenerator(tree, { directory: 'my-lib', - linter: Linter.None, + linter: 'none', }); }); it('should add update configuration when eslint is passed', async () => { await addLinting(tree, { projectName: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', tsConfigPaths: ['my-lib/tsconfig.lib.json'], projectRoot: 'my-lib', addPlugin: true, @@ -32,7 +31,7 @@ describe('Add Linting', () => { it('should not add lint target when "none" is passed', async () => { await addLinting(tree, { projectName: 'my-lib', - linter: Linter.None, + linter: 'none', tsConfigPaths: ['my-lib/tsconfig.lib.json'], projectRoot: 'my-lib', addPlugin: true, diff --git a/packages/expo/src/utils/add-linting.ts b/packages/expo/src/utils/add-linting.ts index 4a79dcf4a5..65a8d9a584 100644 --- a/packages/expo/src/utils/add-linting.ts +++ b/packages/expo/src/utils/add-linting.ts @@ -26,7 +26,7 @@ interface NormalizedSchema { } export async function addLinting(host: Tree, options: NormalizedSchema) { - if (options.linter === Linter.None) { + if (options.linter === 'none') { return () => {}; } const tasks: GeneratorCallback[] = []; diff --git a/packages/nest/src/generators/application/lib/normalize-options.ts b/packages/nest/src/generators/application/lib/normalize-options.ts index a4bf2b56d7..9fab6236d6 100644 --- a/packages/nest/src/generators/application/lib/normalize-options.ts +++ b/packages/nest/src/generators/application/lib/normalize-options.ts @@ -3,7 +3,6 @@ import { determineProjectNameAndRootOptions, ensureRootProjectName, } 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 type { Schema as NodeApplicationGeneratorOptions } from '@nx/node/src/generators/application/schema'; import type { ApplicationGeneratorOptions, NormalizedOptions } from '../schema'; @@ -33,7 +32,7 @@ export async function normalizeOptions( strict: options.strict ?? false, appProjectName, appProjectRoot, - linter: options.linter ?? Linter.EsLint, + linter: options.linter ?? 'eslint', unitTestRunner: options.unitTestRunner ?? 'jest', e2eTestRunner: options.e2eTestRunner ?? 'jest', useProjectJson: options.useProjectJson ?? !isUsingTsSolutionSetup(tree), diff --git a/packages/nest/src/generators/library/lib/normalize-options.ts b/packages/nest/src/generators/library/lib/normalize-options.ts index 4081d4d3ec..0237652e68 100644 --- a/packages/nest/src/generators/library/lib/normalize-options.ts +++ b/packages/nest/src/generators/library/lib/normalize-options.ts @@ -5,7 +5,6 @@ import { } from '@nx/devkit/src/generators/project-name-and-root-utils'; 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 { Linter } from '@nx/eslint'; import type { LibraryGeneratorOptions, NormalizedOptions } from '../schema'; import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup'; @@ -46,7 +45,7 @@ export async function normalizeOptions( controller: options.controller ?? false, fileName, global: options.global ?? false, - linter: options.linter ?? Linter.EsLint, + linter: options.linter ?? 'eslint', parsedTags, prefix: getNpmScope(tree), // we could also allow customizing this projectName: diff --git a/packages/next/src/generators/application/lib/add-e2e.ts b/packages/next/src/generators/application/lib/add-e2e.ts index afb5f7b723..ba8620f477 100644 --- a/packages/next/src/generators/application/lib/add-e2e.ts +++ b/packages/next/src/generators/application/lib/add-e2e.ts @@ -7,7 +7,6 @@ import { writeJson, } from '@nx/devkit'; import { getE2EWebServerInfo } from '@nx/devkit/src/generators/e2e-web-server-info-utils'; -import { Linter } from '@nx/eslint'; import { webStaticServeGenerator } from '@nx/web'; import type { PackageJson } from 'nx/src/utils/package-json'; import { nxVersion } from '../../../utils/versions'; @@ -73,7 +72,7 @@ export async function addE2e(host: Tree, options: NormalizedSchema) { const e2eTask = await configurationGenerator(host, { ...options, - linter: Linter.EsLint, + linter: 'eslint', project: options.e2eProjectName, directory: 'src', skipFormat: true, diff --git a/packages/next/src/generators/application/lib/add-linting.spec.ts b/packages/next/src/generators/application/lib/add-linting.spec.ts index c6b272eefc..547df15fbf 100644 --- a/packages/next/src/generators/application/lib/add-linting.spec.ts +++ b/packages/next/src/generators/application/lib/add-linting.spec.ts @@ -6,7 +6,6 @@ import { } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { addLinting } from './add-linting'; -import { Linter } from '@nx/eslint'; import { NormalizedSchema } from './normalize-options'; describe('updateEslint', () => { @@ -20,7 +19,7 @@ describe('updateEslint', () => { appProjectRoot: 'my-app', directory: 'my-app', importPath: '@proj/my-app', - linter: Linter.EsLint, + linter: 'eslint', unitTestRunner: 'jest', e2eProjectName: 'my-app-e2e', e2eProjectRoot: 'my-app-e2e', diff --git a/packages/next/src/generators/application/lib/add-linting.ts b/packages/next/src/generators/application/lib/add-linting.ts index 4df1638252..fd760193bf 100644 --- a/packages/next/src/generators/application/lib/add-linting.ts +++ b/packages/next/src/generators/application/lib/add-linting.ts @@ -1,4 +1,4 @@ -import { Linter, lintProjectGenerator } from '@nx/eslint'; +import { lintProjectGenerator } from '@nx/eslint'; import { addDependenciesToPackageJson, 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)) { addPredefinedConfigToFlatLintConfig( host, diff --git a/packages/next/src/generators/application/lib/normalize-options.ts b/packages/next/src/generators/application/lib/normalize-options.ts index 0f4d6658de..ea743873c6 100644 --- a/packages/next/src/generators/application/lib/normalize-options.ts +++ b/packages/next/src/generators/application/lib/normalize-options.ts @@ -1,9 +1,8 @@ -import { joinPathFragments, names, readNxJson, Tree } from '@nx/devkit'; +import { joinPathFragments, readNxJson, Tree } from '@nx/devkit'; import { determineProjectNameAndRootOptions, ensureRootProjectName, } from '@nx/devkit/src/generators/project-name-and-root-utils'; -import { Linter } from '@nx/eslint'; import { assertValidStyle } from '@nx/react/src/utils/assertion'; import { Schema } from '../schema'; import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup'; @@ -87,7 +86,7 @@ export async function normalizeOptions( e2eProjectRoot, e2eTestRunner: options.e2eTestRunner || 'playwright', fileName, - linter: options.linter || Linter.EsLint, + linter: options.linter || 'eslint', outputPath, parsedTags, projectName: appProjectName, diff --git a/packages/next/src/generators/component/component.spec.ts b/packages/next/src/generators/component/component.spec.ts index d89527922f..7b36f97c63 100644 --- a/packages/next/src/generators/component/component.spec.ts +++ b/packages/next/src/generators/component/component.spec.ts @@ -3,7 +3,6 @@ import { componentGenerator } from './component'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { Tree } from '@nx/devkit'; import { libraryGenerator } from '@nx/react'; -import { Linter } from '@nx/eslint'; describe('component', () => { let tree: Tree; @@ -18,7 +17,7 @@ describe('component', () => { }); await libraryGenerator(tree, { directory: libName, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', skipFormat: true, skipTsConfig: false, diff --git a/packages/next/src/generators/library/lib/normalize-options.spec.ts b/packages/next/src/generators/library/lib/normalize-options.spec.ts index 68c6d00d04..4666038f2e 100644 --- a/packages/next/src/generators/library/lib/normalize-options.spec.ts +++ b/packages/next/src/generators/library/lib/normalize-options.spec.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { Linter } from '@nx/eslint'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { normalizeOptions } from './normalize-options'; @@ -14,7 +13,7 @@ describe('normalizeOptions', () => { const options = await normalizeOptions(tree, { directory: 'my-lib', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'jest', }); diff --git a/packages/next/src/generators/library/library.spec.ts b/packages/next/src/generators/library/library.spec.ts index fbbce75a41..850973931f 100644 --- a/packages/next/src/generators/library/library.spec.ts +++ b/packages/next/src/generators/library/library.spec.ts @@ -7,7 +7,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import libraryGenerator from './library'; import { Schema } from './schema'; @@ -25,7 +24,7 @@ describe('next library', () => { it('should use @nx/next images.d.ts file', async () => { const baseOptions: Schema = { directory: '', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', @@ -47,7 +46,7 @@ describe('next library', () => { it('should add jsxImportSource in tsconfig.json for @emotion/styled', async () => { const baseOptions: Schema = { directory: '', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', @@ -79,7 +78,7 @@ describe('next library', () => { const appTree = createTreeWithEmptyWorkspace(); await libraryGenerator(appTree, { directory: 'my-buildable-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', @@ -95,7 +94,7 @@ describe('next library', () => { await libraryGenerator(appTree, { directory: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', @@ -122,7 +121,7 @@ describe('next library', () => { await libraryGenerator(appTree, { directory: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', @@ -164,7 +163,7 @@ describe('next library', () => { it('should add project references when using TS solution', async () => { await libraryGenerator(tree, { directory: 'mylib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', @@ -287,7 +286,7 @@ describe('next library', () => { const appTree = createTreeWithEmptyWorkspace(); await libraryGenerator(appTree, { directory: 'my-buildable-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, skipTsConfig: false, unitTestRunner: 'jest', @@ -302,7 +301,7 @@ describe('next library', () => { it('should create a correct package.json for buildable libraries', async () => { await libraryGenerator(tree, { directory: 'mylib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, skipTsConfig: false, unitTestRunner: 'jest', @@ -387,7 +386,7 @@ describe('next library', () => { await libraryGenerator(tree, { directory: 'mylib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, skipTsConfig: false, unitTestRunner: 'jest', @@ -448,7 +447,7 @@ describe('next library', () => { it('should generate project.json if useProjectJson is true', async () => { await libraryGenerator(tree, { directory: 'mylib', - linter: Linter.EsLint, + linter: 'eslint', unitTestRunner: 'jest', style: 'css', addPlugin: true, diff --git a/packages/node/src/generators/application/application.ts b/packages/node/src/generators/application/application.ts index fd95774c43..d025565f30 100644 --- a/packages/node/src/generators/application/application.ts +++ b/packages/node/src/generators/application/application.ts @@ -32,7 +32,7 @@ import { tsConfigBaseOptions, } from '@nx/js'; import { esbuildVersion } from '@nx/js/src/utils/versions'; -import { Linter, lintProjectGenerator } from '@nx/eslint'; +import { lintProjectGenerator } from '@nx/eslint'; import { join } from 'path'; import { expressTypingsVersion, @@ -541,7 +541,7 @@ export async function applicationGeneratorInternal(tree: Tree, schema: Schema) { updateTsConfigOptions(tree, options); - if (options.linter === Linter.EsLint) { + if (options.linter === 'eslint') { const lintTask = await addLintingToApplication(tree, options); tasks.push(lintTask); } @@ -678,7 +678,7 @@ async function normalizeOptions( appProjectRoot, importPath, parsedTags, - linter: options.linter ?? Linter.EsLint, + linter: options.linter ?? 'eslint', unitTestRunner: options.unitTestRunner ?? 'jest', rootProject: options.rootProject ?? false, port: options.port ?? 3000, diff --git a/packages/node/src/generators/e2e-project/e2e-project.ts b/packages/node/src/generators/e2e-project/e2e-project.ts index 0680a2ae9c..c20e271931 100644 --- a/packages/node/src/generators/e2e-project/e2e-project.ts +++ b/packages/node/src/generators/e2e-project/e2e-project.ts @@ -15,7 +15,7 @@ import { writeJson, } from '@nx/devkit'; import { determineProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils'; -import { Linter, lintProjectGenerator } from '@nx/eslint'; +import { lintProjectGenerator } from '@nx/eslint'; import { javaScriptOverride, typeScriptOverride, @@ -230,10 +230,10 @@ export async function e2eProjectGeneratorInternal( ); tasks.push(installTask); - if (options.linter === Linter.EsLint) { + if (options.linter === 'eslint') { const linterTask = await lintProjectGenerator(host, { project: options.e2eProjectName, - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, tsConfigPaths: [ joinPathFragments(options.e2eProjectRoot, 'tsconfig.json'), diff --git a/packages/nuxt/src/generators/application/application.ts b/packages/nuxt/src/generators/application/application.ts index 365ebdf013..b6b39d1cae 100644 --- a/packages/nuxt/src/generators/application/application.ts +++ b/packages/nuxt/src/generators/application/application.ts @@ -20,7 +20,6 @@ import { initGenerator as jsInitGenerator, } from '@nx/js'; import { updateGitIgnore } from '../../utils/update-gitignore'; -import { Linter } from '@nx/eslint'; import { addE2e } from './lib/add-e2e'; import { addLinting } from '../../utils/add-linting'; import { addVitest } from './lib/add-vitest'; @@ -167,7 +166,7 @@ export async function applicationGeneratorInternal(tree: Tree, schema: Schema) { await addLinting(tree, { projectName: options.projectName, projectRoot: options.appProjectRoot, - linter: options.linter ?? Linter.EsLint, + linter: options.linter ?? 'eslint', unitTestRunner: options.unitTestRunner, rootProject: options.rootProject, }) diff --git a/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts b/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts index ae9e94ff32..b59126dd11 100644 --- a/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts +++ b/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts @@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { logger, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import applicationGenerator from '../application/application'; import storybookConfigurationGenerator from './configuration'; import { componentGenerator } from '@nx/vue'; @@ -84,7 +83,7 @@ export async function createTestApp( await applicationGenerator(appTree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'none', diff --git a/packages/playwright/src/utils/add-linter.ts b/packages/playwright/src/utils/add-linter.ts index ebf60c4800..269cc8fc90 100644 --- a/packages/playwright/src/utils/add-linter.ts +++ b/packages/playwright/src/utils/add-linter.ts @@ -37,7 +37,7 @@ export async function addLinterToPlaywrightProject( tree: Tree, options: PlaywrightLinterOptions ): Promise { - if (options.linter === Linter.None) { + if (options.linter === 'none') { 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); } diff --git a/packages/plugin/src/generators/create-package/create-package.spec.ts b/packages/plugin/src/generators/create-package/create-package.spec.ts index 2a1cf22537..dac6d71f6e 100644 --- a/packages/plugin/src/generators/create-package/create-package.spec.ts +++ b/packages/plugin/src/generators/create-package/create-package.spec.ts @@ -7,7 +7,6 @@ import { Tree, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { PackageJson } from 'nx/src/utils/package-json'; import pluginGenerator from '../plugin/plugin'; import { createPackageGenerator } from './create-package'; @@ -26,7 +25,7 @@ const getSchema: ( skipTsConfig: false, skipFormat: false, skipLintChecks: false, - linter: Linter.EsLint, + linter: 'eslint', unitTestRunner: 'jest', ...overrides, }); @@ -44,7 +43,7 @@ describe('NxPlugin Create Package Generator', () => { skipTsConfig: false, skipFormat: false, skipLintChecks: false, - linter: Linter.EsLint, + linter: 'eslint', unitTestRunner: 'jest', }); }); diff --git a/packages/plugin/src/generators/executor/executor.spec.ts b/packages/plugin/src/generators/executor/executor.spec.ts index 24fd9de440..c81f0b9f60 100644 --- a/packages/plugin/src/generators/executor/executor.spec.ts +++ b/packages/plugin/src/generators/executor/executor.spec.ts @@ -6,7 +6,6 @@ import { executorGenerator } from './executor'; import { pluginGenerator } from '../plugin/plugin'; import { libraryGenerator as jsLibraryGenerator } from '@nx/js'; import { setCwd } from '@nx/devkit/internal-testing-utils'; -import { Linter } from '@nx/eslint'; describe('NxPlugin Executor Generator', () => { let tree: Tree; @@ -20,7 +19,7 @@ describe('NxPlugin Executor Generator', () => { await pluginGenerator(tree, { directory: projectName, unitTestRunner: 'jest', - linter: Linter.EsLint, + linter: 'eslint', compiler: 'tsc', }); }); diff --git a/packages/plugin/src/generators/generator/generator.spec.ts b/packages/plugin/src/generators/generator/generator.spec.ts index 6a2a460c97..3f30115555 100644 --- a/packages/plugin/src/generators/generator/generator.spec.ts +++ b/packages/plugin/src/generators/generator/generator.spec.ts @@ -10,7 +10,6 @@ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { libraryGenerator as jsLibraryGenerator } from '@nx/js'; import { pluginGenerator } from '../plugin/plugin'; import { generatorGenerator } from './generator'; -import { Linter } from '@nx/eslint'; import { setCwd } from '@nx/devkit/internal-testing-utils'; describe('NxPlugin Generator Generator', () => { @@ -24,7 +23,7 @@ describe('NxPlugin Generator Generator', () => { await pluginGenerator(tree, { directory: projectName, unitTestRunner: 'jest', - linter: Linter.EsLint, + linter: 'eslint', compiler: 'tsc', }); }); diff --git a/packages/plugin/src/generators/lint-checks/generator.spec.ts b/packages/plugin/src/generators/lint-checks/generator.spec.ts index 88b10111ef..8c255884f7 100644 --- a/packages/plugin/src/generators/lint-checks/generator.spec.ts +++ b/packages/plugin/src/generators/lint-checks/generator.spec.ts @@ -11,7 +11,6 @@ import { } from '@nx/devkit'; import type { Linter as ESLint } from 'eslint'; -import { Linter } from '@nx/eslint'; import generator from './generator'; import pluginGenerator from '../plugin/plugin'; @@ -29,7 +28,7 @@ describe('lint-checks generator', () => { directory: 'plugin', importPath: '@acme/plugin', compiler: 'tsc', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, skipLintChecks: true, // we manually call it s.t. we can update config files first diff --git a/packages/plugin/src/generators/migration/migration.spec.ts b/packages/plugin/src/generators/migration/migration.spec.ts index 23b5403492..9530abdf8f 100644 --- a/packages/plugin/src/generators/migration/migration.spec.ts +++ b/packages/plugin/src/generators/migration/migration.spec.ts @@ -5,7 +5,6 @@ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { migrationGenerator } from './migration'; import { pluginGenerator } from '../plugin/plugin'; import { setCwd } from '@nx/devkit/internal-testing-utils'; -import { Linter } from '@nx/eslint'; describe('NxPlugin migration generator', () => { let tree: Tree; @@ -20,7 +19,7 @@ describe('NxPlugin migration generator', () => { name: projectName, directory: 'packages/my-plugin', unitTestRunner: 'jest', - linter: Linter.EsLint, + linter: 'eslint', compiler: 'tsc', }); }); diff --git a/packages/plugin/src/generators/plugin/plugin.spec.ts b/packages/plugin/src/generators/plugin/plugin.spec.ts index 4dab8d3891..7cf5c56d30 100644 --- a/packages/plugin/src/generators/plugin/plugin.spec.ts +++ b/packages/plugin/src/generators/plugin/plugin.spec.ts @@ -10,7 +10,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { PackageJson } from 'nx/src/utils/package-json'; import { pluginGenerator } from './plugin'; import { Schema } from './schema'; @@ -23,7 +22,7 @@ const getSchema: (overrides?: Partial) => Schema = ( skipTsConfig: false, skipFormat: false, skipLintChecks: false, - linter: Linter.EsLint, + linter: 'eslint', unitTestRunner: 'jest', ...overrides, }); diff --git a/packages/plugin/src/generators/plugin/plugin.ts b/packages/plugin/src/generators/plugin/plugin.ts index e479df8929..4f6057a9d6 100644 --- a/packages/plugin/src/generators/plugin/plugin.ts +++ b/packages/plugin/src/generators/plugin/plugin.ts @@ -11,7 +11,6 @@ import { updateJson, updateProjectConfiguration, } from '@nx/devkit'; -import { Linter } from '@nx/eslint'; import { libraryGenerator as jsLibraryGenerator } from '@nx/js'; import { 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 }); } diff --git a/packages/react-native/src/generators/application/application.spec.ts b/packages/react-native/src/generators/application/application.spec.ts index ace4f98422..aed467923a 100644 --- a/packages/react-native/src/generators/application/application.spec.ts +++ b/packages/react-native/src/generators/application/application.spec.ts @@ -9,7 +9,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { reactNativeApplicationGenerator } from './application'; describe('app', () => { @@ -24,7 +23,7 @@ describe('app', () => { await reactNativeApplicationGenerator(appTree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, unitTestRunner: 'none', @@ -40,7 +39,7 @@ describe('app', () => { directory: 'my-app', displayName: 'myApp', tags: 'one,two', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, unitTestRunner: 'none', @@ -57,7 +56,7 @@ describe('app', () => { await reactNativeApplicationGenerator(appTree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, unitTestRunner: 'jest', @@ -102,7 +101,7 @@ describe('app', () => { await reactNativeApplicationGenerator(appTree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, unitTestRunner: 'jest', @@ -118,7 +117,7 @@ describe('app', () => { await reactNativeApplicationGenerator(appTree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, unitTestRunner: 'none', @@ -134,7 +133,7 @@ describe('app', () => { await reactNativeApplicationGenerator(appTree, { name: 'my-app', directory: 'my-dir', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'detox', install: false, bundler: 'vite', @@ -185,7 +184,7 @@ describe('app', () => { it('should create e2e app without directory', async () => { await reactNativeApplicationGenerator(appTree, { directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'detox', install: false, bundler: 'vite', @@ -240,7 +239,7 @@ describe('app', () => { await reactNativeApplicationGenerator(appTree, { directory: 'my-app', displayName: 'myApp', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, skipPackageJson: true, @@ -280,7 +279,7 @@ describe('app', () => { directory: 'my-app', displayName: 'myApp', tags: 'one,two', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, unitTestRunner: 'jest', @@ -417,7 +416,7 @@ describe('app', () => { name: 'my-app', displayName: 'myApp', tags: 'one,two', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, unitTestRunner: 'jest', @@ -443,7 +442,7 @@ describe('app', () => { it('should generate project.json if useProjectJson is true', async () => { await reactNativeApplicationGenerator(tree, { directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'cypress', install: false, unitTestRunner: 'jest', diff --git a/packages/react-native/src/generators/application/lib/normalize-options.spec.ts b/packages/react-native/src/generators/application/lib/normalize-options.spec.ts index 9eb74780f8..dd17f16344 100644 --- a/packages/react-native/src/generators/application/lib/normalize-options.spec.ts +++ b/packages/react-native/src/generators/application/lib/normalize-options.spec.ts @@ -1,6 +1,5 @@ import { Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { Schema } from '../schema'; import { normalizeOptions } from './normalize-options'; @@ -14,7 +13,7 @@ describe('Normalize Options', () => { it('should normalize options with name in kebab case', async () => { const schema: Schema = { directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', e2eTestRunner: 'none', install: false, unitTestRunner: 'none', @@ -35,7 +34,7 @@ describe('Normalize Options', () => { name: 'my-app', parsedTags: [], projectName: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', entryFile: 'src/main.tsx', e2eTestRunner: 'none', unitTestRunner: 'none', @@ -54,7 +53,7 @@ describe('Normalize Options', () => { directory: 'myApp', e2eTestRunner: 'none', install: false, - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', bundler: 'vite', }; @@ -78,7 +77,7 @@ describe('Normalize Options', () => { unitTestRunner: 'none', install: false, bundler: 'vite', - linter: Linter.None, + linter: 'none', rootProject: false, e2eProjectName: 'myApp-e2e', e2eProjectRoot: 'myApp-e2e', @@ -93,7 +92,7 @@ describe('Normalize Options', () => { directory: 'directory/my-app', e2eTestRunner: 'none', install: false, - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', bundler: 'vite', }; @@ -117,7 +116,7 @@ describe('Normalize Options', () => { unitTestRunner: 'none', install: false, bundler: 'vite', - linter: Linter.None, + linter: 'none', rootProject: false, e2eProjectName: 'my-app-e2e', e2eProjectRoot: 'directory/my-app-e2e', @@ -131,7 +130,7 @@ describe('Normalize Options', () => { directory: 'directory/my-app', e2eTestRunner: 'none', install: false, - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', bundler: 'vite', }; @@ -155,7 +154,7 @@ describe('Normalize Options', () => { unitTestRunner: 'none', install: false, bundler: 'vite', - linter: Linter.None, + linter: 'none', rootProject: false, e2eProjectName: 'my-app-e2e', e2eProjectRoot: 'directory/my-app-e2e', @@ -170,7 +169,7 @@ describe('Normalize Options', () => { displayName: 'My App', e2eTestRunner: 'none', install: false, - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', bundler: 'vite', }; @@ -194,7 +193,7 @@ describe('Normalize Options', () => { unitTestRunner: 'none', install: false, bundler: 'vite', - linter: Linter.None, + linter: 'none', rootProject: false, e2eProjectName: 'my-app-e2e', e2eProjectRoot: 'my-app-e2e', diff --git a/packages/react-native/src/generators/library/library.spec.ts b/packages/react-native/src/generators/library/library.spec.ts index 863fe0a0c4..ff273452d8 100644 --- a/packages/react-native/src/generators/library/library.spec.ts +++ b/packages/react-native/src/generators/library/library.spec.ts @@ -9,7 +9,6 @@ import { } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import libraryGenerator from './library'; -import { Linter } from '@nx/eslint'; import { hasPlugin as hasRollupPlugin } from '@nx/rollup/src/utils/has-plugin'; import { Schema } from './schema'; @@ -18,7 +17,7 @@ describe('lib', () => { const defaultSchema: Schema = { directory: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'jest', diff --git a/packages/react-native/src/utils/add-linting.spec.ts b/packages/react-native/src/utils/add-linting.spec.ts index 2f467c3d00..4cc6e39b81 100644 --- a/packages/react-native/src/utils/add-linting.spec.ts +++ b/packages/react-native/src/utils/add-linting.spec.ts @@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { readProjectConfiguration, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { libraryGenerator } from '@nx/js'; import { addLinting } from './add-linting'; @@ -14,14 +13,14 @@ describe('Add Linting', () => { await libraryGenerator(tree, { name: 'my-lib', directory: 'libs/my-lib', - linter: Linter.None, + linter: 'none', }); }); it('should add a .eslintrc.json when is passed', async () => { await addLinting(tree, { projectName: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'], projectRoot: 'libs/my-lib', }); @@ -32,7 +31,7 @@ describe('Add Linting', () => { it('should not add lint target when "none" is passed', async () => { await addLinting(tree, { projectName: 'my-lib', - linter: Linter.None, + linter: 'none', tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'], projectRoot: 'libs/my-lib', }); diff --git a/packages/react-native/src/utils/add-linting.ts b/packages/react-native/src/utils/add-linting.ts index ccb56e9ea0..fd35cbe9f1 100644 --- a/packages/react-native/src/utils/add-linting.ts +++ b/packages/react-native/src/utils/add-linting.ts @@ -26,7 +26,7 @@ interface NormalizedSchema { } export async function addLinting(host: Tree, options: NormalizedSchema) { - if (options.linter === Linter.None) { + if (options.linter === 'none') { return () => {}; } const tasks: GeneratorCallback[] = []; diff --git a/packages/react-native/src/utils/testing-generators.ts b/packages/react-native/src/utils/testing-generators.ts index 61c00cad55..d9debaf0a7 100644 --- a/packages/react-native/src/utils/testing-generators.ts +++ b/packages/react-native/src/utils/testing-generators.ts @@ -1,10 +1,9 @@ import { addProjectConfiguration, names, Tree } from '@nx/devkit'; import applicationGenerator from '../generators/application/application'; -import { Linter } from '@nx/eslint'; export async function createApp(tree: Tree, appName: string): Promise { await applicationGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'none', diff --git a/packages/react/src/generators/application/application.legacy.spec.ts b/packages/react/src/generators/application/application.legacy.spec.ts index 83f5e8ac5b..a88ba0b834 100644 --- a/packages/react/src/generators/application/application.legacy.spec.ts +++ b/packages/react/src/generators/application/application.legacy.spec.ts @@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { getInstalledCypressMajorVersion } from '@nx/cypress/src/utils/versions'; import { readProjectConfiguration, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { applicationGenerator } from './application'; import { Schema } from './schema'; // 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', skipFormat: false, directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', style: 'css', strict: true, addPlugin: false, diff --git a/packages/react/src/generators/application/application.spec.ts b/packages/react/src/generators/application/application.spec.ts index a448e0a22b..cbce937112 100644 --- a/packages/react/src/generators/application/application.spec.ts +++ b/packages/react/src/generators/application/application.spec.ts @@ -13,7 +13,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { applicationGenerator } from './application'; import { Schema } from './schema'; @@ -46,7 +45,7 @@ describe('app', () => { e2eTestRunner: 'cypress', skipFormat: true, directory: 'my-app', - linter: Linter.EsLint, + linter: 'eslint', style: 'css', strict: true, addPlugin: true, @@ -685,7 +684,7 @@ describe('app', () => { }); 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'); @@ -1327,7 +1326,7 @@ describe('app', () => { await applicationGenerator(tree, { directory: 'myapp', addPlugin: false, - linter: Linter.None, + linter: 'none', style: 'none', e2eTestRunner: 'none', }); @@ -1368,7 +1367,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'myapp', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'vitest', @@ -1537,7 +1536,7 @@ describe('app', () => { directory: 'myapp', name: 'myapp', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'vitest', @@ -1563,7 +1562,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'myapp', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'none', @@ -1573,7 +1572,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'libs/nested1', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'none', @@ -1582,7 +1581,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'libs/nested2', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'none', @@ -1610,7 +1609,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'myapp', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'none', @@ -1620,7 +1619,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'apps/nested1', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'none', @@ -1630,7 +1629,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'apps/nested2', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'none', @@ -1640,7 +1639,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'packages/shared/util', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'none', @@ -1662,7 +1661,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'apps/my-app', bundler: 'webpack', - linter: Linter.EsLint, + linter: 'eslint', style: 'none', e2eTestRunner: 'none', addPlugin: true, @@ -1715,7 +1714,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'apps/my-app', bundler: 'webpack', - linter: Linter.EsLint, + linter: 'eslint', style: 'none', e2eTestRunner: 'none', addPlugin: false, @@ -1733,7 +1732,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'apps/my-app', bundler: 'rspack', - linter: Linter.EsLint, + linter: 'eslint', style: 'none', e2eTestRunner: 'none', addPlugin: false, @@ -1751,7 +1750,7 @@ describe('app', () => { await applicationGenerator(appTree, { directory: 'myapp', addPlugin: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'none', bundler: 'vite', unitTestRunner: 'vitest', diff --git a/packages/react/src/generators/application/lib/add-linting.ts b/packages/react/src/generators/application/lib/add-linting.ts index c79d84ebef..02b5ccce48 100644 --- a/packages/react/src/generators/application/lib/add-linting.ts +++ b/packages/react/src/generators/application/lib/add-linting.ts @@ -5,7 +5,7 @@ import { ensurePackage, readJson, } from '@nx/devkit'; -import { Linter, lintProjectGenerator } from '@nx/eslint'; +import { lintProjectGenerator } from '@nx/eslint'; import { addExtendsToLintConfig, addOverrideToLintConfig, @@ -21,7 +21,7 @@ import { nxVersion } from '../../../utils/versions'; export async function addLinting(host: Tree, options: NormalizedSchema) { const tasks: GeneratorCallback[] = []; - if (options.linter === Linter.EsLint) { + if (options.linter === 'eslint') { const lintTask = await lintProjectGenerator(host, { linter: options.linter, project: options.projectName, diff --git a/packages/react/src/generators/component-story/component-story.spec.ts b/packages/react/src/generators/component-story/component-story.spec.ts index 22290a367e..d02a415398 100644 --- a/packages/react/src/generators/component-story/component-story.spec.ts +++ b/packages/react/src/generators/component-story/component-story.spec.ts @@ -4,7 +4,6 @@ import { getProjects, Tree, updateProjectConfiguration } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import libraryGenerator from '../library/library'; import componentStoryGenerator from './component-story'; -import { Linter } from '@nx/eslint'; describe('react:component-story', () => { let appTree: Tree; @@ -600,7 +599,7 @@ export async function createTestUILib(libName: string): Promise { let appTree = createTreeWithEmptyWorkspace(); await libraryGenerator(appTree, { directory: libName, - linter: Linter.EsLint, + linter: 'eslint', component: true, skipFormat: true, skipTsConfig: false, diff --git a/packages/react/src/generators/component-test/component-test.spec.ts b/packages/react/src/generators/component-test/component-test.spec.ts index ea75998189..fd83000449 100644 --- a/packages/react/src/generators/component-test/component-test.spec.ts +++ b/packages/react/src/generators/component-test/component-test.spec.ts @@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { assertMinimumCypressVersion } from '@nx/cypress/src/utils/versions'; import { Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import libraryGenerator from '../library/library'; import { componentTestGenerator } from './component-test'; @@ -19,7 +18,7 @@ describe(componentTestGenerator.name, () => { it('should create component test for tsx files', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -39,7 +38,7 @@ describe(componentTestGenerator.name, () => { it('should create component test for js files', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -60,7 +59,7 @@ describe(componentTestGenerator.name, () => { it('should not overwrite exising component test', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -82,7 +81,7 @@ describe(componentTestGenerator.name, () => { it('should not throw if path is invalid', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -102,7 +101,7 @@ describe(componentTestGenerator.name, () => { it('should handle being provided the full path to the component', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -123,7 +122,7 @@ describe(componentTestGenerator.name, () => { it('should handle props', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -163,7 +162,7 @@ export function AnotherCmp(props: AnotherCmpProps) { it('should handle no props', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -195,7 +194,7 @@ export function AnotherCmp() { it('should handle default export', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -238,7 +237,7 @@ export function AnotherCmp2() { it('should handle named exports', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -283,7 +282,7 @@ export function AnotherCmp2() { it('should handle props', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -322,7 +321,7 @@ export function AnotherCmp(props: AnotherCmpProps) { it('should handle props with inline type', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -357,7 +356,7 @@ export function AnotherCmp(props: AnotherCmpProps) { it('should handle destructured props with no type', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -393,7 +392,7 @@ export function AnotherCmp(props: AnotherCmpProps) { // this is the default behavior of the library component generator mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -414,7 +413,7 @@ export function AnotherCmp(props: AnotherCmpProps) { it('should handle default export', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -452,7 +451,7 @@ export default function AnotherCmp(props: AnotherCmpProps) { it('should handle named exports', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, diff --git a/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts b/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts index 7fdc629004..44e4e71214 100644 --- a/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts +++ b/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts @@ -7,7 +7,6 @@ import { updateProjectConfiguration, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { applicationGenerator } from '../application/application'; import { componentGenerator } from '../component/component'; import { libraryGenerator } from '../library/library'; @@ -63,7 +62,7 @@ describe('React:CypressComponentTestConfiguration', () => { it('should generate cypress config with vite', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -71,7 +70,7 @@ describe('React:CypressComponentTestConfiguration', () => { bundler: 'vite', }); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -117,7 +116,7 @@ describe('React:CypressComponentTestConfiguration', () => { it('should generate cypress component test config with --build-target', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -125,7 +124,7 @@ describe('React:CypressComponentTestConfiguration', () => { bundler: 'vite', }); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -183,7 +182,7 @@ describe('React:CypressComponentTestConfiguration', () => { it('should generate cypress component test config with project graph', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -191,7 +190,7 @@ describe('React:CypressComponentTestConfiguration', () => { bundler: 'vite', }); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -248,7 +247,7 @@ describe('React:CypressComponentTestConfiguration', () => { it('should generate cypress component test config with webpack', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -256,7 +255,7 @@ describe('React:CypressComponentTestConfiguration', () => { bundler: 'webpack', }); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -312,7 +311,7 @@ describe('React:CypressComponentTestConfiguration', () => { it('should generate tests for existing tsx components', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -320,7 +319,7 @@ describe('React:CypressComponentTestConfiguration', () => { bundler: 'vite', }); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -356,7 +355,7 @@ describe('React:CypressComponentTestConfiguration', () => { it('should generate tests for existing js components', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -364,7 +363,7 @@ describe('React:CypressComponentTestConfiguration', () => { bundler: 'vite', }); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -410,7 +409,7 @@ describe('React:CypressComponentTestConfiguration', () => { it('should throw error when an invalid --build-target is provided', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -421,7 +420,7 @@ describe('React:CypressComponentTestConfiguration', () => { directory: 'some-lib', style: 'scss', unitTestRunner: 'none', - linter: Linter.None, + linter: 'none', skipFormat: false, skipTsConfig: false, }); @@ -464,7 +463,7 @@ describe('React:CypressComponentTestConfiguration', () => { it('should setup cypress config files correctly', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -472,7 +471,7 @@ describe('React:CypressComponentTestConfiguration', () => { bundler: 'vite', }); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, @@ -563,7 +562,7 @@ describe('React:CypressComponentTestConfiguration', () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'scss', unitTestRunner: 'none', @@ -571,7 +570,7 @@ describe('React:CypressComponentTestConfiguration', () => { bundler: 'vite', }); await libraryGenerator(tree, { - linter: Linter.EsLint, + linter: 'eslint', directory: 'some-lib', skipFormat: true, skipTsConfig: false, diff --git a/packages/react/src/generators/federate-module/federate-module.spec.ts b/packages/react/src/generators/federate-module/federate-module.spec.ts index cf42d76f65..30ec6b0ad9 100644 --- a/packages/react/src/generators/federate-module/federate-module.spec.ts +++ b/packages/react/src/generators/federate-module/federate-module.spec.ts @@ -5,7 +5,6 @@ import { Schema } from './schema'; import { Schema as remoteSchma } from '../remote/schema'; import { federateModuleGenerator } from './federate-module'; import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports'; -import { Linter } from '@nx/eslint'; import remoteGeneratorInternal from '../remote/remote'; describe('federate-module', () => { @@ -81,7 +80,7 @@ describe('federate-module', () => { directory: 'my-existing-remote', e2eTestRunner: 'none', skipFormat: false, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', unitTestRunner: 'none', bundler: 'webpack', diff --git a/packages/react/src/generators/host/host.rspack.spec.ts b/packages/react/src/generators/host/host.rspack.spec.ts index 883edb85e3..9d5305779f 100644 --- a/packages/react/src/generators/host/host.rspack.spec.ts +++ b/packages/react/src/generators/host/host.rspack.spec.ts @@ -2,7 +2,6 @@ import { Tree, updateJson, writeJson } from '@nx/devkit'; import { ProjectGraph, readJson } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import hostGenerator from './host'; -import { Linter } from '@nx/eslint'; jest.mock('@nx/devkit', () => { const original = jest.requireActual('@nx/devkit'); @@ -112,7 +111,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: false, @@ -132,7 +131,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: false, @@ -150,7 +149,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: true, @@ -175,7 +174,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: false, @@ -200,7 +199,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', skipFormat: true, @@ -217,7 +216,7 @@ describe('hostGenerator', () => { directory: 'test', ssr: true, style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: false, @@ -259,7 +258,7 @@ describe('hostGenerator', () => { directory: 'test', ssr: true, style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: true, @@ -303,7 +302,7 @@ describe('hostGenerator', () => { directory: 'foo/host-app', remotes: ['remote1', 'remote2', 'remote3'], e2eTestRunner: 'none', - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: 'none', typescriptConfiguration: false, @@ -325,7 +324,7 @@ describe('hostGenerator', () => { directory: 'foo/host-app', remotes: ['remote1', 'remote2', 'remote3'], e2eTestRunner: 'none', - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: 'none', typescriptConfiguration: true, @@ -350,7 +349,7 @@ describe('hostGenerator', () => { remotes: [remote], dynamic: true, e2eTestRunner: 'none', - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: 'none', typescriptConfiguration: false, @@ -368,7 +367,7 @@ describe('hostGenerator', () => { remotes: [remote], dynamic: true, e2eTestRunner: 'none', - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: 'none', typescriptConfiguration: false, @@ -448,7 +447,7 @@ describe('hostGenerator', () => { addPlugin: true, remotes: ['remote1', 'remote2', 'remote3'], e2eTestRunner: 'none', - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: 'none', typescriptConfiguration: false, diff --git a/packages/react/src/generators/host/host.webpack.spec.ts b/packages/react/src/generators/host/host.webpack.spec.ts index 820b644e88..68fb7d7d05 100644 --- a/packages/react/src/generators/host/host.webpack.spec.ts +++ b/packages/react/src/generators/host/host.webpack.spec.ts @@ -1,9 +1,7 @@ -import * as devkit from '@nx/devkit'; import type { Tree } from '@nx/devkit'; import { ProjectGraph, readJson } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import hostGenerator from './host'; -import { Linter } from '@nx/eslint'; jest.mock('@nx/devkit', () => { const original = jest.requireActual('@nx/devkit'); @@ -113,7 +111,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: false, @@ -133,7 +131,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: false, @@ -151,7 +149,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: true, @@ -176,7 +174,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: false, @@ -201,7 +199,7 @@ describe('hostGenerator', () => { await hostGenerator(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', skipFormat: true, @@ -217,7 +215,7 @@ describe('hostGenerator', () => { directory: 'test', ssr: true, style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: false, @@ -263,7 +261,7 @@ describe('hostGenerator', () => { directory: 'test', ssr: true, style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', typescriptConfiguration: true, @@ -311,7 +309,7 @@ describe('hostGenerator', () => { directory: 'foo/host-app', remotes: ['remote1', 'remote2', 'remote3'], e2eTestRunner: 'none', - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: 'none', typescriptConfiguration: false, @@ -333,7 +331,7 @@ describe('hostGenerator', () => { directory: 'foo/host-app', remotes: ['remote1', 'remote2', 'remote3'], e2eTestRunner: 'none', - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: 'none', typescriptConfiguration: true, @@ -358,7 +356,7 @@ describe('hostGenerator', () => { remotes: [remote], dynamic: true, e2eTestRunner: 'none', - linter: Linter.None, + linter: 'none', style: 'css', unitTestRunner: 'none', typescriptConfiguration: false, diff --git a/packages/react/src/generators/library/lib/add-linting.ts b/packages/react/src/generators/library/lib/add-linting.ts index 7a0c990012..4643a806ea 100644 --- a/packages/react/src/generators/library/lib/add-linting.ts +++ b/packages/react/src/generators/library/lib/add-linting.ts @@ -1,5 +1,5 @@ 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 { addDependenciesToPackageJson, @@ -18,7 +18,7 @@ import { import { useFlatConfig } from '@nx/eslint/src/utils/flat-config'; export async function addLinting(host: Tree, options: NormalizedSchema) { - if (options.linter === Linter.EsLint) { + if (options.linter === 'eslint') { const tasks: GeneratorCallback[] = []; const lintTask = await lintProjectGenerator(host, { linter: options.linter, diff --git a/packages/react/src/generators/library/lib/normalize-options.spec.ts b/packages/react/src/generators/library/lib/normalize-options.spec.ts index 4df5ca1698..02ea68832f 100644 --- a/packages/react/src/generators/library/lib/normalize-options.spec.ts +++ b/packages/react/src/generators/library/lib/normalize-options.spec.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { Linter } from '@nx/eslint'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { normalizeOptions } from './normalize-options'; @@ -14,7 +13,7 @@ describe('normalizeOptions', () => { const options = await normalizeOptions(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'jest', }); @@ -30,7 +29,7 @@ describe('normalizeOptions', () => { let options = await normalizeOptions(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', bundler: 'rollup', }); @@ -42,7 +41,7 @@ describe('normalizeOptions', () => { options = await normalizeOptions(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', bundler: 'vite', }); @@ -56,7 +55,7 @@ describe('normalizeOptions', () => { const options = await normalizeOptions(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', bundler: 'vite', unitTestRunner: 'vitest', }); @@ -73,7 +72,7 @@ describe('normalizeOptions', () => { const options = await normalizeOptions(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', bundler: 'vite', unitTestRunner: 'jest', }); @@ -90,7 +89,7 @@ describe('normalizeOptions', () => { const options = await normalizeOptions(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', buildable: true, unitTestRunner: 'jest', }); @@ -106,7 +105,7 @@ describe('normalizeOptions', () => { const options = await normalizeOptions(tree, { directory: 'test', style: 'css', - linter: Linter.None, + linter: 'none', buildable: true, bundler: 'none', unitTestRunner: 'jest', diff --git a/packages/react/src/generators/library/library.spec.ts b/packages/react/src/generators/library/library.spec.ts index 1e4884dc78..469815a192 100644 --- a/packages/react/src/generators/library/library.spec.ts +++ b/packages/react/src/generators/library/library.spec.ts @@ -10,7 +10,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { nxVersion } from '../../utils/versions'; import applicationGenerator from '../application/application'; import libraryGenerator from './library'; @@ -29,7 +28,7 @@ describe('lib', () => { > = getInstalledCypressMajorVersion as never; let defaultSchema: Schema = { directory: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, skipTsConfig: false, unitTestRunner: 'jest', @@ -483,7 +482,7 @@ describe('lib', () => { await applicationGenerator(tree, { compiler: 'babel', e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, unitTestRunner: 'jest', directory: 'my-app', @@ -510,7 +509,7 @@ describe('lib', () => { it('should initialize routes if none were set up then add new route', async () => { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, unitTestRunner: 'jest', directory: 'my-app', diff --git a/packages/react/src/generators/redux/redux.spec.ts b/packages/react/src/generators/redux/redux.spec.ts index e2a61f70e9..11780e82d4 100644 --- a/packages/react/src/generators/redux/redux.spec.ts +++ b/packages/react/src/generators/redux/redux.spec.ts @@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { readJson, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { applicationGenerator } from '../application/application'; import { libraryGenerator } from '../library/library'; import { reduxGenerator } from './redux'; @@ -14,7 +13,7 @@ describe('redux', () => { appTree = createTreeWithEmptyWorkspace(); await libraryGenerator(appTree, { directory: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, skipTsConfig: false, style: 'css', @@ -60,7 +59,7 @@ describe('redux', () => { it('should configure app main', async () => { await applicationGenerator(appTree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'none', diff --git a/packages/react/src/generators/remote/remote.rspack.spec.ts b/packages/react/src/generators/remote/remote.rspack.spec.ts index 13a54fc1fa..8d1c42831b 100644 --- a/packages/react/src/generators/remote/remote.rspack.spec.ts +++ b/packages/react/src/generators/remote/remote.rspack.spec.ts @@ -7,7 +7,6 @@ import { readProjectConfiguration, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import remote from './remote'; import host from '../host/host'; import { getRootTsConfigPathInTree } from '@nx/js'; @@ -114,7 +113,7 @@ describe('remote generator', () => { skipFormat: true, bundler: 'rspack', e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', unitTestRunner: 'jest', style: 'css', }); @@ -124,7 +123,7 @@ describe('remote generator', () => { name: 'remote', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -143,7 +142,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -175,7 +174,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -208,7 +207,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'jest', @@ -235,7 +234,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -252,7 +251,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -270,7 +269,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -292,7 +291,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -317,7 +316,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'jest', @@ -344,7 +343,7 @@ describe('remote generator', () => { devServerPort: 4209, dynamic: true, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'jest', @@ -362,7 +361,7 @@ describe('remote generator', () => { directory: 'test/my-app', devServerPort: 4209, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'jest', diff --git a/packages/react/src/generators/remote/remote.webpack.spec.ts b/packages/react/src/generators/remote/remote.webpack.spec.ts index bdbd69e053..2aaebfeb88 100644 --- a/packages/react/src/generators/remote/remote.webpack.spec.ts +++ b/packages/react/src/generators/remote/remote.webpack.spec.ts @@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { ProjectGraph, readJson, readNxJson } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import remote from './remote'; import { getRootTsConfigPathInTree } from '@nx/js'; @@ -106,7 +105,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -138,7 +137,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -171,7 +170,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'jest', @@ -198,7 +197,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -215,7 +214,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -233,7 +232,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -253,7 +252,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'jest', @@ -282,7 +281,7 @@ describe('remote generator', () => { directory: 'test', devServerPort: 4201, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'jest', @@ -313,7 +312,7 @@ describe('remote generator', () => { devServerPort: 4209, dynamic: true, e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'jest', diff --git a/packages/react/src/generators/setup-ssr/setup-ssr.spec.ts b/packages/react/src/generators/setup-ssr/setup-ssr.spec.ts index 196f1f4287..86958e59aa 100644 --- a/packages/react/src/generators/setup-ssr/setup-ssr.spec.ts +++ b/packages/react/src/generators/setup-ssr/setup-ssr.spec.ts @@ -1,16 +1,7 @@ -import * as devkit from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { - joinPathFragments, - ProjectGraph, - readCachedProjectGraph, - readJson, - readNxJson, - Tree, -} from '@nx/devkit'; +import { ProjectGraph, readJson, Tree } from '@nx/devkit'; import applicationGenerator from '../application/application'; import setupSsrGenerator from './setup-ssr'; -import { Linter } from '@nx/eslint'; jest.mock('@nx/devkit', () => { const myAppData = { @@ -126,7 +117,7 @@ describe('setupSsrGenerator', () => { await applicationGenerator(tree, { directory: appName, style: 'css', - linter: Linter.None, + linter: 'none', unitTestRunner: 'none', e2eTestRunner: 'none', skipFormat: true, diff --git a/packages/react/src/generators/stories/stories.app.spec.ts b/packages/react/src/generators/stories/stories.app.spec.ts index e136e976da..5a4bbd53db 100644 --- a/packages/react/src/generators/stories/stories.app.spec.ts +++ b/packages/react/src/generators/stories/stories.app.spec.ts @@ -2,7 +2,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import applicationGenerator from '../application/application'; import storiesGenerator from './stories'; @@ -321,7 +320,7 @@ export async function createTestUIApp( await applicationGenerator(appTree, { e2eTestRunner: 'cypress', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'none', diff --git a/packages/react/src/generators/stories/stories.lib.spec.ts b/packages/react/src/generators/stories/stories.lib.spec.ts index 71bba6f9af..1586e15156 100644 --- a/packages/react/src/generators/stories/stories.lib.spec.ts +++ b/packages/react/src/generators/stories/stories.lib.spec.ts @@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { Tree } from '@nx/devkit'; import storiesGenerator from './stories'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import libraryGenerator from '../library/library'; describe('react:stories for libraries', () => { @@ -233,7 +232,7 @@ export async function createTestUILib( let appTree = createTreeWithEmptyWorkspace(); await libraryGenerator(appTree, { - linter: Linter.EsLint, + linter: 'eslint', component: true, skipFormat: true, skipTsConfig: false, diff --git a/packages/react/src/generators/stories/stories.nextjs.spec.ts b/packages/react/src/generators/stories/stories.nextjs.spec.ts index 9e70a4ddc1..7bd56fb507 100644 --- a/packages/react/src/generators/stories/stories.nextjs.spec.ts +++ b/packages/react/src/generators/stories/stories.nextjs.spec.ts @@ -7,7 +7,6 @@ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; // nx-ignore-next-line import { applicationGenerator } from '@nx/next'; /* eslint-enable @nx/enforce-module-boundaries */ -import { Linter } from '@nx/eslint'; describe('nextjs:stories for applications', () => { let tree: Tree; @@ -87,7 +86,7 @@ export async function createTestUIApp(name: string): Promise { const tree = createTreeWithEmptyWorkspace(); await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'none', diff --git a/packages/react/src/generators/storybook-configuration/configuration.spec.ts b/packages/react/src/generators/storybook-configuration/configuration.spec.ts index 474435061e..e0de26d3e9 100644 --- a/packages/react/src/generators/storybook-configuration/configuration.spec.ts +++ b/packages/react/src/generators/storybook-configuration/configuration.spec.ts @@ -1,6 +1,5 @@ import { logger, Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import applicationGenerator from '../application/application'; import componentGenerator from '../component/component'; import libraryGenerator from '../library/library'; @@ -133,7 +132,7 @@ export async function createTestUILib( let appTree = createTreeWithEmptyWorkspace(); await libraryGenerator(appTree, { - linter: Linter.EsLint, + linter: 'eslint', component: true, skipFormat: true, skipTsConfig: false, @@ -153,7 +152,7 @@ export async function createTestAppLib( await applicationGenerator(appTree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, style: 'css', unitTestRunner: 'none', diff --git a/packages/react/src/migrations/update-19-6-0/update-ssr-server-port.spec.ts b/packages/react/src/migrations/update-19-6-0/update-ssr-server-port.spec.ts index 12309384fb..f75d4ba3dc 100644 --- a/packages/react/src/migrations/update-19-6-0/update-ssr-server-port.spec.ts +++ b/packages/react/src/migrations/update-19-6-0/update-ssr-server-port.spec.ts @@ -1,7 +1,6 @@ import { readProjectConfiguration, type Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports'; import hostGenerator from '../../generators/host/host'; -import { Linter } from '@nx/eslint'; import updateSsrServerPort from './update-ssr-server-port'; 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', unitTestRunner: 'none', ssr: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', remotes: ['product'], bundler: 'webpack', @@ -132,7 +131,7 @@ describe('update-19-6-0 update-ssr-server-port migration', () => { e2eTestRunner: 'none', unitTestRunner: 'none', ssr: true, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', bundler: 'webpack', }); @@ -183,7 +182,7 @@ describe('update-19-6-0 update-ssr-server-port migration', () => { e2eTestRunner: 'none', unitTestRunner: 'none', ssr: false, - linter: Linter.EsLint, + linter: 'eslint', style: 'css', bundler: 'webpack', }); diff --git a/packages/react/src/utils/testing-generators.ts b/packages/react/src/utils/testing-generators.ts index 248511c54b..262ce5053f 100644 --- a/packages/react/src/utils/testing-generators.ts +++ b/packages/react/src/utils/testing-generators.ts @@ -1,11 +1,10 @@ import { addProjectConfiguration, names, Tree } from '@nx/devkit'; import applicationGenerator from '../generators/application/application'; -import { Linter } from '@nx/eslint'; export async function createApp(tree: Tree, appName: string): Promise { await applicationGenerator(tree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'none', diff --git a/packages/remix/src/generators/application/lib/normalize-options.ts b/packages/remix/src/generators/application/lib/normalize-options.ts index 15afaac332..978326d359 100644 --- a/packages/remix/src/generators/application/lib/normalize-options.ts +++ b/packages/remix/src/generators/application/lib/normalize-options.ts @@ -3,7 +3,6 @@ import { determineProjectNameAndRootOptions, ensureRootProjectName, } 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 { type NxRemixGeneratorSchema } from '../schema'; @@ -49,7 +48,7 @@ export async function normalizeOptions( return { ...options, - linter: options.linter ?? Linter.EsLint, + linter: options.linter ?? 'eslint', projectName: appProjectName, projectRoot, importPath, diff --git a/packages/storybook/src/generators/configuration/configuration.spec.ts b/packages/storybook/src/generators/configuration/configuration.spec.ts index 2b6bba1dd1..332855f241 100644 --- a/packages/storybook/src/generators/configuration/configuration.spec.ts +++ b/packages/storybook/src/generators/configuration/configuration.spec.ts @@ -10,7 +10,6 @@ import { } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { libraryGenerator } from '@nx/js'; import { TsConfig } from '../../utils/utilities'; 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 () => { await libraryGenerator(tree, { directory: 'test-ui-lib2', - linter: Linter.EsLint, + linter: 'eslint', addPlugin: true, }); @@ -509,7 +508,7 @@ describe('@nx/storybook:configuration for Storybook v7', () => { it('should have the proper typings', async () => { await libraryGenerator(tree, { directory: 'test-ui-lib2', - linter: Linter.EsLint, + linter: 'eslint', addPlugin: true, }); diff --git a/packages/storybook/src/generators/configuration/configuration.ts b/packages/storybook/src/generators/configuration/configuration.ts index 7acd7c53dd..ab7ee91a42 100644 --- a/packages/storybook/src/generators/configuration/configuration.ts +++ b/packages/storybook/src/generators/configuration/configuration.ts @@ -31,7 +31,7 @@ import { projectIsRootProjectInStandaloneWorkspace, updateLintConfig, } from './lib/util-functions'; -import { Linter } from '@nx/eslint'; +import type { LinterType } from '@nx/eslint'; import { findStorybookAndBuildTargetsAndCompiler, pleaseUpgrade, @@ -250,7 +250,7 @@ function normalizeSchema( const defaults = { interactionTests: true, - linter: Linter.EsLint, + linter: 'eslint' as LinterType, js: false, tsConfiguration: true, addPlugin, diff --git a/packages/storybook/src/generators/configuration/lib/util-functions.ts b/packages/storybook/src/generators/configuration/lib/util-functions.ts index b32ac740e2..2af9a9b035 100644 --- a/packages/storybook/src/generators/configuration/lib/util-functions.ts +++ b/packages/storybook/src/generators/configuration/lib/util-functions.ts @@ -16,7 +16,7 @@ import { workspaceRoot, writeJson, } from '@nx/devkit'; -import { Linter } from '@nx/eslint'; +import type { LinterType } from '@nx/eslint'; import { join, relative } from 'path'; import { dedupe, @@ -467,7 +467,7 @@ export function normalizeSchema( ): StorybookConfigureSchema { const defaults = { configureCypress: true, - linter: Linter.EsLint, + linter: 'eslint' as LinterType, js: false, }; return { diff --git a/packages/storybook/src/generators/cypress-project/cypress-project.spec.ts b/packages/storybook/src/generators/cypress-project/cypress-project.spec.ts index 060aad209b..075a0e0219 100644 --- a/packages/storybook/src/generators/cypress-project/cypress-project.spec.ts +++ b/packages/storybook/src/generators/cypress-project/cypress-project.spec.ts @@ -11,7 +11,6 @@ import { updateNxJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { libraryGenerator } from '@nx/js'; import { cypressProjectGenerator } from './cypress-project'; @@ -31,7 +30,7 @@ describe('@nx/storybook:cypress-project', () => { await cypressProjectGenerator(tree, { name: 'test-ui-lib', directory: 'apps/test-ui-lib-e2e', - linter: Linter.EsLint, + linter: 'eslint', }); expect(tree.exists('apps/test-ui-lib-e2e/cypress.config.ts')).toBeTruthy(); @@ -46,7 +45,7 @@ describe('@nx/storybook:cypress-project', () => { await cypressProjectGenerator(tree, { name: 'test-ui-lib', directory: 'apps/test-ui-lib-e2e', - linter: Linter.EsLint, + linter: 'eslint', }); const project = readProjectConfiguration(tree, 'test-ui-lib-e2e'); @@ -64,7 +63,7 @@ describe('@nx/storybook:cypress-project', () => { await cypressProjectGenerator(tree, { name: 'test-ui-lib', directory: 'apps/one/two/test-ui-lib-e2e', - linter: Linter.EsLint, + linter: 'eslint', }); expect(readProjectConfiguration(tree, 'test-ui-lib-e2e')).toBeDefined(); expect( @@ -83,7 +82,7 @@ describe('@nx/storybook:cypress-project', () => { await cypressProjectGenerator(tree, { name: 'test-ui-lib', directory: 'apps/test-ui-lib-e2e', - linter: Linter.EsLint, + linter: 'eslint', }); // ASSERT diff --git a/packages/storybook/src/utils/testing.ts b/packages/storybook/src/utils/testing.ts index 919c6b7a17..32aeb93c91 100644 --- a/packages/storybook/src/utils/testing.ts +++ b/packages/storybook/src/utils/testing.ts @@ -1,14 +1,13 @@ import { Tree } from '@nx/devkit'; import { libraryGenerator } from '@nx/js'; -import { Linter } from '@nx/eslint'; export async function createTestUILibNoNgDevkit( appTree: Tree, libName: string ): Promise { await libraryGenerator(appTree, { - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, skipTsConfig: false, unitTestRunner: 'none', diff --git a/packages/vue/src/generators/application/application.ts b/packages/vue/src/generators/application/application.ts index af135f440d..1b3a9225de 100644 --- a/packages/vue/src/generators/application/application.ts +++ b/packages/vue/src/generators/application/application.ts @@ -9,7 +9,6 @@ import { Tree, writeJson, } from '@nx/devkit'; -import { Linter } from '@nx/eslint'; import { initGenerator as jsInitGenerator } from '@nx/js'; import { Schema } from './schema'; import { normalizeOptions } from './lib/normalize-options'; @@ -123,7 +122,7 @@ export async function applicationGeneratorInternal( { name: options.projectName, projectRoot: options.appProjectRoot, - linter: options.linter ?? Linter.EsLint, + linter: options.linter ?? 'eslint', unitTestRunner: options.unitTestRunner, skipPackageJson: options.skipPackageJson, setParserOptionsProject: options.setParserOptionsProject, diff --git a/packages/vue/src/generators/library/library.spec.ts b/packages/vue/src/generators/library/library.spec.ts index 0e7228daa1..a450afb7bd 100644 --- a/packages/vue/src/generators/library/library.spec.ts +++ b/packages/vue/src/generators/library/library.spec.ts @@ -8,7 +8,6 @@ import { writeJson, } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import { nxVersion } from '../../utils/versions'; import libraryGenerator from './library'; import { Schema } from './schema'; @@ -18,7 +17,7 @@ describe('library', () => { let defaultSchema: Schema = { directory: 'my-lib', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: false, skipTsConfig: false, unitTestRunner: 'vitest', diff --git a/packages/vue/src/generators/stories/lib/component-story.spec.ts b/packages/vue/src/generators/stories/lib/component-story.spec.ts index 4bf0b4555a..6c752940f5 100644 --- a/packages/vue/src/generators/stories/lib/component-story.spec.ts +++ b/packages/vue/src/generators/stories/lib/component-story.spec.ts @@ -2,7 +2,6 @@ import { getProjects, Tree, updateProjectConfiguration } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import libraryGenerator from '../../library/library'; import { createComponentStories } from './component-story'; -import { Linter } from '@nx/eslint'; describe('vue:component-story', () => { let appTree: Tree; @@ -112,7 +111,7 @@ export async function createTestUILib(libName: string): Promise { let appTree = createTreeWithEmptyWorkspace(); await libraryGenerator(appTree, { directory: libName, - linter: Linter.EsLint, + linter: 'eslint', component: true, skipFormat: true, skipTsConfig: false, diff --git a/packages/vue/src/generators/stories/stories.app.spec.ts b/packages/vue/src/generators/stories/stories.app.spec.ts index c1f60e8f9f..d12419355f 100644 --- a/packages/vue/src/generators/stories/stories.app.spec.ts +++ b/packages/vue/src/generators/stories/stories.app.spec.ts @@ -1,6 +1,5 @@ import { Tree } from '@nx/devkit'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import applicationGenerator from '../application/application'; import storiesGenerator from './stories'; @@ -245,7 +244,7 @@ export async function createTestUIApp( await applicationGenerator(appTree, { e2eTestRunner: 'none', - linter: Linter.EsLint, + linter: 'eslint', skipFormat: true, style: 'css', unitTestRunner: 'none', diff --git a/packages/vue/src/generators/stories/stories.lib.spec.ts b/packages/vue/src/generators/stories/stories.lib.spec.ts index 585f7cf28f..0ed55eabe7 100644 --- a/packages/vue/src/generators/stories/stories.lib.spec.ts +++ b/packages/vue/src/generators/stories/stories.lib.spec.ts @@ -1,7 +1,6 @@ import { Tree } from '@nx/devkit'; import storiesGenerator from './stories'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; -import { Linter } from '@nx/eslint'; import libraryGenerator from '../library/library'; const componentContent = `