Skip to content

Commit

Permalink
chore(linter): try another CI run
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed Aug 14, 2024
1 parent 556cd15 commit 89334d2
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 89 deletions.
3 changes: 1 addition & 2 deletions e2e/esbuild/src/esbuild.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ describe('EsBuild Plugin', () => {
expect(
readJson(`dist/libs/${parentLib}/package.json`).dependencies
).toEqual({
// TODO: why is this and only this getting added?
'@eslint/eslintrc': expect.any(String),
'jsonc-eslint-parser': expect.any(String),
// Don't care about the versions, just that they exist
rambda: expect.any(String),
lodash: expect.any(String),
Expand Down
10 changes: 10 additions & 0 deletions e2e/js/src/js-packaging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ import {
import { join } from 'path';

describe('packaging libs', () => {
let originalEslintUseFlatConfigVal: string | undefined;
beforeAll(() => {
// Opt into legacy .eslintrc config format for these tests
originalEslintUseFlatConfigVal = process.env.ESLINT_USE_FLAT_CONFIG;
process.env.ESLINT_USE_FLAT_CONFIG = 'false';
});
afterAll(() => {
process.env.ESLINT_USE_FLAT_CONFIG = originalEslintUseFlatConfigVal;
});

let scope: string;

beforeEach(() => {
Expand Down
10 changes: 10 additions & 0 deletions e2e/nx/src/import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ import { execSync } from 'node:child_process';
import { join } from 'path';

describe('Nx Import', () => {
let originalEslintUseFlatConfigVal: string | undefined;
beforeAll(() => {
// Opt into legacy .eslintrc config format for these tests
originalEslintUseFlatConfigVal = process.env.ESLINT_USE_FLAT_CONFIG;
process.env.ESLINT_USE_FLAT_CONFIG = 'false';
});
afterAll(() => {
process.env.ESLINT_USE_FLAT_CONFIG = originalEslintUseFlatConfigVal;
});

let proj: string;
const tempImportE2ERoot = join(e2eCwd, 'nx-import');
beforeAll(() => {
Expand Down
9 changes: 5 additions & 4 deletions nx-dev/nx-dev-e2e/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, test, expect } from '@playwright/test';
import { expect, test } from '@playwright/test';
/**
* Assert a text is present on the visited page.
* @param page
Expand All @@ -11,11 +11,12 @@ export function assertTextOnPage(
title: string,
selector: string = 'h1'
): void {
test.describe(path, () =>
// eslint-disable-next-line playwright/valid-title
test.describe(path, () => {
test(`should display "${title}"`, async ({ page }) => {
await page.goto(path);
const locator = page.locator(selector);
await expect(locator).toContainText(title);
})
);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

exports[`convert-to-flat-config generator should add env configuration 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const globals = require('globals');
const js = require('@eslint/js');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -52,9 +52,9 @@ module.exports = [

exports[`convert-to-flat-config generator should add global and env configuration 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const globals = require('globals');
const js = require('@eslint/js');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -106,8 +106,8 @@ module.exports = [

exports[`convert-to-flat-config generator should add global configuration 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const nxEslintPlugin = require('@nx/eslint-plugin');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -155,8 +155,8 @@ module.exports = [

exports[`convert-to-flat-config generator should add global eslintignores 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const nxEslintPlugin = require('@nx/eslint-plugin');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -204,9 +204,9 @@ module.exports = [

exports[`convert-to-flat-config generator should add parser 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const typescriptEslintParser = require('@typescript-eslint/parser');
const js = require('@eslint/js');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -254,11 +254,11 @@ module.exports = [

exports[`convert-to-flat-config generator should add plugins 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const eslintPluginImport = require('eslint-plugin-import');
const eslintPluginSingleName = require('eslint-plugin-single-name');
const scopeEslintPluginWithName = require('@scope/eslint-plugin-with-name');
const justScopeEslintPlugin = require('@just-scope/eslint-plugin');
const js = require('@eslint/js');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -312,8 +312,8 @@ module.exports = [

exports[`convert-to-flat-config generator should add settings 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const nxEslintPlugin = require('@nx/eslint-plugin');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -361,8 +361,8 @@ module.exports = [

exports[`convert-to-flat-config generator should convert json successfully 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const nxEslintPlugin = require('@nx/eslint-plugin');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -430,8 +430,8 @@ module.exports = [

exports[`convert-to-flat-config generator should convert yaml successfully 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const nxEslintPlugin = require('@nx/eslint-plugin');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -499,8 +499,8 @@ module.exports = [

exports[`convert-to-flat-config generator should convert yml successfully 1`] = `
"const { FlatCompat } = require('@eslint/eslintrc');
const nxEslintPlugin = require('@nx/eslint-plugin');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ describe('convertEslintJsonToFlatConfig', () => {

expect(content).toMatchInlineSnapshot(`
"const { FlatCompat } = require("@eslint/eslintrc");
const js = require("@eslint/js");
const baseConfig = require("../../eslint.config.js");
const globals = require("globals");
const js = require("@eslint/js");
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
module.exports = [
Expand Down Expand Up @@ -222,14 +222,11 @@ describe('convertEslintJsonToFlatConfig', () => {
],
rules: {}
},
...compat.config({ parser: "jsonc-eslint-parser" }).map(config => ({
...config,
{
files: ["**/*.json"],
rules: {
...config.rules,
"@nx/dependency-checks": "error"
}
})),
rules: { "@nx/dependency-checks": "error" },
languageOptions: { parser: require("jsonc-eslint-parser") }
},
{ ignores: [".next/**/*"] },
{ ignores: ["something/else"] }
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ describe('convert-to-flat-config generator', () => {

expect(tree.read('eslint.config.js', 'utf-8')).toMatchInlineSnapshot(`
"const { FlatCompat } = require('@eslint/eslintrc');
const nxEslintPlugin = require('@nx/eslint-plugin');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down Expand Up @@ -392,8 +392,8 @@ describe('convert-to-flat-config generator', () => {

expect(tree.read('eslint.config.js', 'utf-8')).toMatchInlineSnapshot(`
"const { FlatCompat } = require('@eslint/eslintrc');
const nxEslintPlugin = require('@nx/eslint-plugin');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
Expand Down
7 changes: 3 additions & 4 deletions packages/eslint/src/generators/utils/eslint-file.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,9 @@ module.exports = [
const baseConfig = require("../../eslint.config.js");
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
module.exports = [
...baseConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ exports[`@nx/eslint:workspace-rules-project should generate the required files 4
`;

exports[`@nx/eslint:workspace-rules-project should generate the required files 5`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'eslint-rules',
preset: '../../jest.preset.js',
transform: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`jestProject --babelJest should generate proper jest.transform when --compiler=swc and supportTsx is true 1`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'lib1',
preset: '../../jest.preset.js',
transform: {
Expand All @@ -23,8 +22,7 @@ export default {
`;

exports[`jestProject --babelJest should generate proper jest.transform when babelJest and supportTsx is true 1`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'lib1',
preset: '../../jest.preset.js',
transform: {
Expand All @@ -37,8 +35,7 @@ export default {
`;

exports[`jestProject --babelJest should generate proper jest.transform when babelJest is true 1`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'lib1',
preset: '../../jest.preset.js',
transform: {
Expand All @@ -51,8 +48,7 @@ export default {
`;

exports[`jestProject --setup-file should have setupFilesAfterEnv and globals.ts-jest in the jest.config when generated for angular 1`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'lib1',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
Expand All @@ -77,8 +73,7 @@ export default {
`;

exports[`jestProject should create a jest.config.ts 1`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'lib1',
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/libs/lib1',
Expand All @@ -87,8 +82,7 @@ export default {
`;

exports[`jestProject should generate files 2`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'lib1',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
Expand Down
12 changes: 4 additions & 8 deletions packages/jest/src/generators/configuration/configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,7 @@ describe('jestProject', () => {
project: 'my-project',
});
expect(tree.read('jest.config.ts', 'utf-8')).toMatchInlineSnapshot(`
"/* eslint-disable */
export default {
"export default {
displayName: 'my-project',
preset: './jest.preset.js',
coverageDirectory: './coverage/my-project',
Expand Down Expand Up @@ -389,8 +388,7 @@ describe('jestProject', () => {
js: true,
});
expect(tree.read('jest.config.js', 'utf-8')).toMatchInlineSnapshot(`
"/* eslint-disable */
module.exports = {
"module.exports = {
displayName: 'my-project',
preset: './jest.preset.js',
coverageDirectory: './coverage/my-project',
Expand Down Expand Up @@ -424,8 +422,7 @@ describe('jestProject', () => {
// ASSERT
expect(tree.read('libs/lib1/jest.config.ts', 'utf-8'))
.toMatchInlineSnapshot(`
"/* eslint-disable */
export default {
"export default {
displayName: 'lib1',
preset: '../../jest.preset.cjs',
coverageDirectory: '../../coverage/libs/lib1',
Expand All @@ -451,8 +448,7 @@ describe('jestProject', () => {
expect(tree.exists('jest.preset.cjs')).toBeTruthy();
expect(tree.read('libs/lib1/jest.config.ts', 'utf-8'))
.toMatchInlineSnapshot(`
"/* eslint-disable */
export default {
"export default {
displayName: 'lib1',
preset: '../../jest.preset.cjs',
coverageDirectory: '../../coverage/libs/lib1',
Expand Down
3 changes: 1 addition & 2 deletions packages/js/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,7 @@ describe('lib', () => {
expect(tree.exists(`my-lib/jest.config.ts`)).toBeTruthy();
expect(tree.read(`my-lib/jest.config.ts`, 'utf-8'))
.toMatchInlineSnapshot(`
"/* eslint-disable */
export default {
"export default {
displayName: 'my-lib',
preset: '../jest.preset.js',
transform: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`lib --testEnvironment should set target jest testEnvironment to jsdom 1`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'my-lib',
preset: '../jest.preset.js',
transform: {
Expand All @@ -15,8 +14,7 @@ export default {
`;

exports[`lib --testEnvironment should set target jest testEnvironment to node by default 1`] = `
"/* eslint-disable */
export default {
"export default {
displayName: 'my-lib',
preset: '../jest.preset.js',
testEnvironment: 'node',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ describe('updateEslint', () => {
const baseConfig = require("../eslint.config.js");
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
module.exports = [
...compat.extends("plugin:@nx/react-typescript", "next", "next/core-web-vitals"),
Expand Down
Loading

0 comments on commit 89334d2

Please sign in to comment.