Skip to content

Commit

Permalink
fix(misc): resolve lint and test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Sep 5, 2024
1 parent 7c03b1d commit e9806c6
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 55 deletions.
9 changes: 8 additions & 1 deletion packages/eslint-plugin/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@
// Installed to workspace by plugins
"@typescript-eslint/parser",
"eslint-config-prettier",
"@angular-eslint/eslint-plugin"
"@angular-eslint/eslint-plugin",
"angular-eslint",
"typescript-eslint",
"@eslint/js",
"eslint-plugin-import",
"eslint-plugin-jsx-a11y",
"eslint-plugin-react",
"eslint-plugin-react-hooks"
]
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,17 @@ module.exports = [
...baseConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.ts', '**/*.tsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
];
Expand Down Expand Up @@ -483,14 +486,17 @@ module.exports = [
...baseConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.ts', '**/*.tsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
];
Expand Down Expand Up @@ -552,14 +558,17 @@ module.exports = [
...baseConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.ts', '**/*.tsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
];
Expand All @@ -573,14 +582,17 @@ module.exports = [
...baseConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.ts', '**/*.tsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
{ ignores: ['ignore/me'] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,15 @@ describe('convertEslintJsonToFlatConfig', () => {
"**/*.ts",
"**/*.tsx"
],
// Override or add rules here
rules: {}
},
{
files: [
"**/*.js",
"**/*.jsx"
],
// Override or add rules here
rules: {}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,17 @@ describe('convert-to-flat-config generator', () => {
...baseConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.ts', '**/*.tsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
];
Expand Down Expand Up @@ -554,17 +557,20 @@ describe('convert-to-flat-config generator', () => {
...baseConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
languageOptions: {
parserOptions: { project: ['apps/dx-assets-ui/tsconfig.*?.json'] },
},
},
{
files: ['**/*.ts', '**/*.tsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
{ ignores: ['__fixtures__/**/*'] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ describe('@nx/eslint:lint-project', () => {
});

it('should generate a flat eslint base config', async () => {
const originalEslintUseFlatConfigVal = process.env.ESLINT_USE_FLAT_CONFIG;
process.env.ESLINT_USE_FLAT_CONFIG = 'true';
await lintProjectGenerator(tree, {
...defaultOptions,
linter: Linter.EsLint,
Expand Down Expand Up @@ -76,13 +78,13 @@ describe('@nx/eslint:lint-project', () => {
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Add your rule overrides here
// Override or add rules here
rules: {},
},
];
"
`);
process.env.ESLINT_USE_FLAT_CONFIG = originalEslintUseFlatConfigVal;
});

it('should generate a eslint config (legacy)', async () => {
Expand Down
55 changes: 3 additions & 52 deletions packages/next/src/generators/application/lib/add-linting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,6 @@ describe('updateEslint', () => {
],
"rules": {},
},
{
"env": {
"jest": true,
},
"files": [
"*.spec.ts",
"*.spec.tsx",
"*.spec.js",
"*.spec.jsx",
],
},
],
}
`);
Expand All @@ -115,6 +104,7 @@ describe('updateEslint', () => {
.toMatchInlineSnapshot(`
"const { FlatCompat } = require("@eslint/eslintrc");
const js = require("@eslint/js");
const nx = require("@nx/eslint-plugin");
const baseConfig = require("../eslint.config.js");
const compat = new FlatCompat({
Expand All @@ -123,48 +113,9 @@ describe('updateEslint', () => {
});
module.exports = [
...compat.extends("plugin:@nx/react-typescript", "next", "next/core-web-vitals"),
...compat.extends("next", "next/core-web-vitals"),
...baseConfig,
{
"files": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx"
],
"rules": {
"@next/next/no-html-link-for-pages": [
"error",
"my-app/pages"
]
}
},
{
files: [
"**/*.ts",
"**/*.tsx"
],
rules: {}
},
{
files: [
"**/*.js",
"**/*.jsx"
],
rules: {}
},
...compat.config({ env: { jest: true } }).map(config => ({
...config,
files: [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.spec.js",
"**/*.spec.jsx"
],
rules: {
...config.rules
}
})),
...nx.configs["flat/react-typescript"],
{ ignores: [".next/**/*"] }
];
"
Expand Down

0 comments on commit e9806c6

Please sign in to comment.