Skip to content

Commit

Permalink
fix(linter): fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Oct 9, 2023
1 parent 37ecc2f commit 2ae52df
Show file tree
Hide file tree
Showing 25 changed files with 59 additions and 59 deletions.
6 changes: 3 additions & 3 deletions e2e/eslint/src/linter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe('Linter', () => {

// Generate a new rule (should also scaffold the required workspace project and tests)
const newRuleName = 'e2e-test-rule-name';
runCLI(`generate @nx/linter:workspace-rule ${newRuleName}`);
runCLI(`generate @nx/eslint:workspace-rule ${newRuleName}`);

// Ensure that the unit tests for the new rule are runnable
const unitTestsOutput = runCLI(`test eslint-rules`);
Expand Down Expand Up @@ -563,7 +563,7 @@ describe('Linter', () => {
);

// migrate to flat structure
runCLI(`generate @nx/linter:convert-to-flat-config`);
runCLI(`generate @nx/eslint:convert-to-flat-config`);
checkFilesExist(
'eslint.config.js',
`apps/${myapp}/eslint.config.js`,
Expand Down Expand Up @@ -596,7 +596,7 @@ describe('Linter', () => {
runCLI(`generate @nx/js:lib ${mylib}`);

// migrate to flat structure
runCLI(`generate @nx/linter:convert-to-flat-config`);
runCLI(`generate @nx/eslint:convert-to-flat-config`);
checkFilesExist(
'eslint.config.js',
`${mylib}/eslint.config.js`,
Expand Down
2 changes: 1 addition & 1 deletion e2e/utils/create-project-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function newProject({
`@nx/esbuild`,
`@nx/jest`,
`@nx/js`,
`@nx/linter`,
`@nx/eslint`,
`@nx/nest`,
`@nx/next`,
`@nx/node`,
Expand Down
6 changes: 3 additions & 3 deletions nx-dev/nx-dev-e2e/src/packages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ const pages: Array<{ title: string; path: string }> = [
{ title: '@nx/eslint', path: '/packages/eslint' },
{
title: '@nx/eslint:workspace-rules-project',
path: '/packages/linter/generators/workspace-rules-project',
path: '/packages/eslint/generators/workspace-rules-project',
},
{
title: '@nx/eslint',
path: '/packages/linter/generators/workspace-rule',
path: '/packages/eslint/generators/workspace-rule',
},
{ title: '@nx/eslint', path: '/packages/linter/executors/eslint' },
{ title: '@nx/eslint', path: '/packages/eslint/executors/eslint' },
{ title: '@nx/nest', path: '/packages/nest' },
{
title: '@nx/nest:application',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type EslintExtensionSchema = {
};

/**
* @deprecated Use tools from `@nx/linter/src/generators/utils/eslint-file` instead
* @deprecated Use tools from `@nx/eslint/src/generators/utils/eslint-file` instead
*/
export const extendAngularEslintJson = (
json: Linter.Config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ exports[`app --project-name-and-root-format=derived should generate correctly wh
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"apps/my-dir/my-app/**/*.ts",
Expand Down Expand Up @@ -350,7 +350,7 @@ exports[`app --project-name-and-root-format=derived should generate correctly wh
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"apps/my-dir/my-app-e2e/**/*.{js,ts}",
Expand Down Expand Up @@ -512,7 +512,7 @@ exports[`app --project-name-and-root-format=derived should generate correctly wh
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"apps/my-app/**/*.ts",
Expand Down Expand Up @@ -590,7 +590,7 @@ exports[`app --project-name-and-root-format=derived should generate correctly wh
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"apps/my-app-e2e/**/*.{js,ts}",
Expand Down Expand Up @@ -963,7 +963,7 @@ exports[`app nested should create project configs 1`] = `
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-dir/my-app/**/*.ts",
Expand Down Expand Up @@ -1041,7 +1041,7 @@ exports[`app nested should create project configs 2`] = `
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-dir/my-app-e2e/**/*.{js,ts}",
Expand Down Expand Up @@ -1121,7 +1121,7 @@ exports[`app not nested should create project configs 1`] = `
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-app/**/*.ts",
Expand Down Expand Up @@ -1199,7 +1199,7 @@ exports[`app not nested should create project configs 2`] = `
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-app-e2e/**/*.{js,ts}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ describe(<%= componentName %>.name, () => {

beforeEach(() => {
TestBed.overrideComponent(<%= componentName %>, {
add: {
add: {
imports: [],
providers: []
}
})
})
})

it('renders', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { installedCypressVersion } from '@nx/cypress/src/utils/cypress-version';
import type { Tree } from '@nx/devkit';
import { writeJson } from '@nx/devkit';
import { Linter } from 'packages/linter/src/generators/utils/linter';
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 { createStorybookTestWorkspaceForLib } from '../utils/testing';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports[`Cypress Project < v7 nested should update configuration 1`] = `
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-dir/my-app-e2e/**/*.{js,ts}",
Expand Down Expand Up @@ -95,7 +95,7 @@ exports[`Cypress Project < v7 project with directory in its name should update c
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-dir/my-app-e2e/**/*.{js,ts}",
Expand All @@ -120,7 +120,7 @@ exports[`Cypress Project < v7 should update project configuration (baseUrl) 1`]
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-app-e2e/**/*.{js,ts}",
Expand Down Expand Up @@ -150,7 +150,7 @@ exports[`Cypress Project < v7 should update project configuration 1`] = `
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-app-e2e/**/*.{js,ts}",
Expand Down Expand Up @@ -180,7 +180,7 @@ exports[`Cypress Project < v7 should update target configurations 1`] = `
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-app-e2e/**/*.{js,ts}",
Expand Down Expand Up @@ -267,7 +267,7 @@ exports[`Cypress Project > v10 should set right path names in \`tsconfig.e2e.jso
exports[`Cypress Project > v10 should update configuration when eslint is passed 1`] = `
{
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-app-e2e/**/*.{js,ts}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ exports[`convertToCypressTen convertCypressProject should infer targets with --a
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"app-e2e/**/*.{js,ts}",
Expand Down Expand Up @@ -246,7 +246,7 @@ exports[`convertToCypressTen convertCypressProject should not break when an inva
},
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"app-e2e/**/*.{js,ts}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Tree,
} from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import { Linter } from 'packages/linter/src/generators/utils/linter';
import { Linter } from '@nx/eslint/src/generators/utils/linter';

import detoxApplicationGenerator from './application';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`@nx/linter:init --linter eslint should generate the global eslint config 1`] = `
exports[`@nx/eslint:init --linter eslint should generate the global eslint config 1`] = `
"{
"root": true,
"ignorePatterns": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`@nx/linter:workspace-rule --dir should support creating the rule in a nested directory 1`] = `
exports[`@nx/eslint:workspace-rule --dir should support creating the rule in a nested directory 1`] = `
"/**
* This file sets you up with structure needed for an ESLint rule.
*
Expand Down Expand Up @@ -41,7 +41,7 @@ export const rule = ESLintUtils.RuleCreator(() => __filename)({
"
`;
exports[`@nx/linter:workspace-rule --dir should support creating the rule in a nested directory 2`] = `
exports[`@nx/eslint:workspace-rule --dir should support creating the rule in a nested directory 2`] = `
"import { TSESLint } from '@typescript-eslint/utils';
import { rule, RULE_NAME } from './another-rule';
Expand All @@ -56,7 +56,7 @@ ruleTester.run(RULE_NAME, rule, {
"
`;
exports[`@nx/linter:workspace-rule --dir should support creating the rule in a nested directory with multiple levels of nesting 1`] = `
exports[`@nx/eslint:workspace-rule --dir should support creating the rule in a nested directory with multiple levels of nesting 1`] = `
"/**
* This file sets you up with structure needed for an ESLint rule.
*
Expand Down Expand Up @@ -97,7 +97,7 @@ export const rule = ESLintUtils.RuleCreator(() => __filename)({
"
`;
exports[`@nx/linter:workspace-rule --dir should support creating the rule in a nested directory with multiple levels of nesting 2`] = `
exports[`@nx/eslint:workspace-rule --dir should support creating the rule in a nested directory with multiple levels of nesting 2`] = `
"import { TSESLint } from '@typescript-eslint/utils';
import { rule, RULE_NAME } from './one-more-rule';
Expand All @@ -112,7 +112,7 @@ ruleTester.run(RULE_NAME, rule, {
"
`;
exports[`@nx/linter:workspace-rule should generate the required files 1`] = `
exports[`@nx/eslint:workspace-rule should generate the required files 1`] = `
"/**
* This file sets you up with structure needed for an ESLint rule.
*
Expand Down Expand Up @@ -153,7 +153,7 @@ export const rule = ESLintUtils.RuleCreator(() => __filename)({
"
`;
exports[`@nx/linter:workspace-rule should generate the required files 2`] = `
exports[`@nx/eslint:workspace-rule should generate the required files 2`] = `
"import { TSESLint } from '@typescript-eslint/utils';
import { rule, RULE_NAME } from './my-rule';
Expand All @@ -168,7 +168,7 @@ ruleTester.run(RULE_NAME, rule, {
"
`;
exports[`@nx/linter:workspace-rule should update the plugin index.ts with the new rule 1`] = `
exports[`@nx/eslint:workspace-rule should update the plugin index.ts with the new rule 1`] = `
"import { RULE_NAME as myRuleName, rule as myRule } from './rules/my-rule';
/**
* Import your custom workspace rules at the top of this file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`@nx/linter:workspace-rules-project should generate the required files 1`] = `
exports[`@nx/eslint:workspace-rules-project should generate the required files 1`] = `
"/**
* Import your custom workspace rules at the top of this file.
*
Expand Down Expand Up @@ -31,7 +31,7 @@ module.exports = {
"
`;

exports[`@nx/linter:workspace-rules-project should generate the required files 2`] = `
exports[`@nx/eslint:workspace-rules-project should generate the required files 2`] = `
"{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
Expand All @@ -51,7 +51,7 @@ exports[`@nx/linter:workspace-rules-project should generate the required files 2
"
`;

exports[`@nx/linter:workspace-rules-project should generate the required files 3`] = `
exports[`@nx/eslint:workspace-rules-project should generate the required files 3`] = `
"{
"extends": "./tsconfig.json",
"compilerOptions": {
Expand All @@ -64,7 +64,7 @@ exports[`@nx/linter:workspace-rules-project should generate the required files 3
"
`;

exports[`@nx/linter:workspace-rules-project should generate the required files 4`] = `
exports[`@nx/eslint:workspace-rules-project should generate the required files 4`] = `
"{
"extends": "./tsconfig.json",
"compilerOptions": {
Expand All @@ -77,7 +77,7 @@ exports[`@nx/linter:workspace-rules-project should generate the required files 4
"
`;

exports[`@nx/linter:workspace-rules-project should generate the required files 5`] = `
exports[`@nx/eslint:workspace-rules-project should generate the required files 5`] = `
"/* eslint-disable */
export default {
displayName: 'eslint-rules',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('update-16-0-0-add-nx-packages', () => {
).not.toBeDefined();
});

it('should add a dependency on @nx/linter', async () => {
it('should add a dependency on @nx/eslint', async () => {
await replacePackage(tree);

const packageJson = readJson(tree, 'package.json');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports[`lib --unit-test-runner none should not generate test configuration 1`]

exports[`lib --unit-test-runner none should not generate test configuration 2`] = `
{
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"my-lib/**/*.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('updateEslint', () => {
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
module.exports = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const skippedFiles = [
'karma.conf.js', // Will be handled by @nx/angular
'jest.preset.js', // Will be handled by @nx/jest
'.storybook', // Will be handled by @nx/storybook
// Will be handled by @nx/linter
// Will be handled by @nx/eslint
'.eslintrc.json',
'.eslintrc.js',
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import type { Linter as ESLint } from 'eslint';
import { Linter } from '@nx/eslint';
import { Schema as EsLintExecutorOptions } from '@nx/eslint/src/executors/eslint/schema';
import { Schema as EsLintExecutorOptions } from '@nx/eslint/src/executors/lint/schema';

import generator from './generator';
import pluginGenerator from '../plugin/plugin';
Expand Down
Loading

0 comments on commit 2ae52df

Please sign in to comment.