Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions modules/eslint-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@
"outputs": ["{workspaceRoot}/dist/modules/eslint-plugin"]
},
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "modules/eslint-plugin/jest.config.ts",
"runInBand": true,
"passWithNoTests": false
},
"executor": "@analogjs/vitest-angular:test",
"dependsOn": ["build"],
"outputs": ["{workspaceRoot}/coverage/modules/eslint-plugin"]
},
"lint": {
Expand Down
2 changes: 1 addition & 1 deletion modules/eslint-plugin/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
import stripJsonComments from 'strip-json-comments';
import type { Schema } from './schema';

export default function addNgRxESLintPlugin(schema: Schema): Rule {
export default function (schema: Schema): Rule {
return (host: Tree, context: SchematicContext) => {
const eslintConfigPath = '.eslintrc.json';
const docs = 'https://ngrx.io/guide/eslint-plugin';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import rule, {
messageId,
} from '../../../src/rules/component-store/require-super-ondestroy';
import { fromFixture, ruleTester } from '../../utils';
import path = require('path');
import * as path from 'path';

type MessageIds = ESLintUtils.InferMessageIdsTypeFromRule<typeof rule>;
type Options = ESLintUtils.InferOptionsTypeFromRule<typeof rule>;
Expand Down
5 changes: 4 additions & 1 deletion modules/eslint-plugin/spec/schematics/ng-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import * as path from 'path';

const schematicRunner = new SchematicTestRunner(
'@ngrx/eslint-plugin',
path.join(__dirname, '../../schematics/collection.json')
path.join(
process.cwd(),
'dist/modules/eslint-plugin/schematics/collection.json'
)
);

test('registers the plugin with the all config', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path = require('path');
import * as path from 'path';
import { createRule } from '../../rule-creator';
import { TSESTree } from '@typescript-eslint/types';

Expand Down
7 changes: 3 additions & 4 deletions modules/eslint-plugin/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
import * as vitest from 'vitest';
import { RuleTester } from '@typescript-eslint/rule-tester';

setupZoneTestEnv();
Object.assign(global, { TextDecoder, TextEncoder });
global.structuredClone = (v) => JSON.parse(JSON.stringify(v));
RuleTester.afterAll = vitest.afterAll;
9 changes: 4 additions & 5 deletions modules/eslint-plugin/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"moduleResolution": "nodenext",
"module": "es2022",
"types": ["node", "vitest", "vitest/globals"],
"target": "es2016",
"esModuleInterop": true,
"types": ["jest", "node"],
"target": "ES2022",
"resolveJsonModule": true
},
"files": ["test-setup.ts"],
"include": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
}
29 changes: 29 additions & 0 deletions modules/eslint-plugin/vite.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// <reference types="vitest" />

import angular from '@analogjs/vite-plugin-angular';

import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
root: __dirname,
plugins: [
angular(),
nxViteTsPaths(),
],
test: {
globals: true,
pool: 'forks',
environment: 'jsdom',
setupFiles: ['test-setup.ts'],
include: ['**/*.spec.ts'],
reporters: ['default']
},
define: {
'import.meta.vitest': mode !== 'production',
},
};
});