Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linter): add cjs, cts, mjs, and mts to the default extensions for the inference plugin #29534

Merged

Conversation

beaussan
Copy link
Contributor

@beaussan beaussan commented Jan 7, 2025

Current Behavior

On the default generated eslint on a ts reference workspace, the config allows for linting of cjs and mjs files

const nx = require('@nx/eslint-plugin');

module.exports = [
  ...nx.configs['flat/base'],
  ...nx.configs['flat/typescript'],
  ...nx.configs['flat/javascript'],
  {
    ignores: ['**/dist'],
  },
  {
    files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
    rules: {
      '@nx/enforce-module-boundaries': [
        'error',
        {
          enforceBuildableLibDependency: true,
          allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?js$'],
          depConstraints: [
            {
              sourceTag: '*',
              onlyDependOnLibsWithTags: ['*'],
            },
          ],
        },
      ],
    },
  },
  {
    files: [
      '**/*.ts',
      '**/*.tsx',
      '**/*.js',
      '**/*.jsx',
      '**/*.cjs',
      '**/*.mjs',
    ],
    // Override or add rules here
    rules: {},
  },
];

However, the default glob is not matching them

Expected Behavior

All cjs and mjs files are included in the lint target detection

Copy link

vercel bot commented Jan 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2025 10:49am

Copy link

nx-cloud bot commented Jan 7, 2025

View your CI Pipeline Execution ↗ for commit afd760b.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 32m 25s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 50s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx format:check --base=ff314... ✅ Succeeded 15s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 14s View ↗
nx documentation --no-dte ✅ Succeeded 34s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-29 11:25:05 UTC

@beaussan beaussan marked this pull request as ready for review January 7, 2025 10:23
@beaussan beaussan requested a review from a team as a code owner January 7, 2025 10:23
@beaussan beaussan requested a review from meeroslav January 7, 2025 10:23
@leosvelperez leosvelperez changed the title fix(linter): add cjs and mjs to the default extensions for the inference plugin fix(linter): add cjs, cts, mjs, and mts to the default extensions for the inference plugin Jan 29, 2025
Copy link
Member

@leosvelperez leosvelperez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I updated it to also include cts and mts.

@leosvelperez leosvelperez enabled auto-merge (squash) January 29, 2025 10:49
@leosvelperez leosvelperez merged commit dfbfe3b into nrwl:master Jan 29, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants