This PR removes these from v20 since they were deprecated and slated for removal: - `executeWebpackDevServerBuilder` export from `@nx/angular/executors`, users should use `executeDevServerBuilder` - `withStylus` util from `@nx/next/plugins/with-stylus` since it was deprecated in v17 and has just throw an error that users need to use SASS with Next.js The `getRollupOptions` function from `@nx/react/plugins/bundle-rollup` has been deprecated as mention previously and slated for removal in v22. New users are using inferred targets from Rollup, and existing projects using this module should run `nx g @nx/rollup:convert-to-inferred` or manually update rollup config to use `withNx` function. Also, bumped some deprecation for later in v21: - Remove inline builds from tsc/swc - Changes to SVGR to align with Webpack v5 (e.g. `import ReactComponent from './img.svg?svgr'`) - Remove `isolatedConfig` from Webpack executor -- requires a migration that extracts to a standard webpack config just in case (different from the original one that extracts to `withNx`) The ESLint TODOs were rescoped to `TODO(eslint)` and we'll look at it in further flat config work rather than tying it to an Nx release. <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
78 lines
3.0 KiB
TypeScript
78 lines
3.0 KiB
TypeScript
import { packageExists } from '../utils/config-utils';
|
|
|
|
const isPrettierAvailable =
|
|
packageExists('prettier') && packageExists('eslint-config-prettier');
|
|
|
|
/**
|
|
* This configuration is intended to be applied to ALL .js and .jsx files
|
|
* within an Nx workspace.
|
|
*
|
|
* It should therefore NOT contain any rules or plugins which are specific
|
|
* to one ecosystem, such as React, Angular, Node etc.
|
|
*
|
|
* We use @typescript-eslint/parser rather than the built in JS parser
|
|
* because that is what Nx ESLint configs have always done and we don't
|
|
* want to change too much all at once.
|
|
*
|
|
* TODO: Evaluate switching to the built-in JS parser (espree) in Nx v11,
|
|
* it should yield a performance improvement but could introduce subtle
|
|
* breaking changes - we should also look to replace all the @typescript-eslint
|
|
* related plugins and rules below.
|
|
*/
|
|
export default {
|
|
env: {
|
|
browser: true,
|
|
node: true,
|
|
},
|
|
parser: '@typescript-eslint/parser',
|
|
parserOptions: {
|
|
ecmaVersion: 2020,
|
|
sourceType: 'module',
|
|
},
|
|
plugins: ['@typescript-eslint'],
|
|
extends: [
|
|
'eslint:recommended',
|
|
'plugin:@typescript-eslint/eslint-recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
...(isPrettierAvailable ? ['prettier'] : []),
|
|
],
|
|
rules: {
|
|
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/no-parameter-properties': 'off',
|
|
/**
|
|
* Until ESM usage in Node matures, using require in e.g. JS config files
|
|
* is by far the more common thing to do, so disabling this to avoid users
|
|
* having to frequently use "eslint-disable-next-line" in their configs.
|
|
*/
|
|
'@typescript-eslint/no-var-requires': 'off',
|
|
|
|
/**
|
|
* From https://typescript-eslint.io/blog/announcing-typescript-eslint-v6/#updated-configuration-rules
|
|
*
|
|
* The following rules were added to preserve the linting rules that were
|
|
* previously defined v5 of `@typescript-eslint`. v6 of `@typescript-eslint`
|
|
* changed how configurations are defined.
|
|
*
|
|
* TODO(eslint): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
|
|
*/
|
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
'no-empty-function': 'off',
|
|
'@typescript-eslint/no-empty-function': 'error',
|
|
'@typescript-eslint/no-inferrable-types': 'error',
|
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
'@typescript-eslint/no-empty-interface': 'error',
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
/**
|
|
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
|
|
* this rule would have created a lot of noise, so we are disabling it by default for now.
|
|
*
|
|
* TODO(eslint): we should make this part of what we re-evaluate in v20
|
|
*/
|
|
'@typescript-eslint/no-require-imports': 'off',
|
|
},
|
|
};
|