This PR removes deprecated code that's been slated for removal in Nx 19 - mentioned as `TODO(v19)` comments. ## Breaking Changes - **CNW:** `create-nx-workspace` no longer support `--preset=empty` and `--preset=core`, use `--preset=apps` and `--preset=npm` respectively. Deprecated in Nx 15.9. - **Next.js:** `NX_` environment variables are no longer bundled into Next.js apps, use `NEXT_PUBLIC` instead. Deprecated in Nx 16.8. - **Webpack, Storybook, Esbuild:** `NX_` environment variables are no longer bundled into browser bundles, use `NX_PUBLIC` instead. This removes the possibility of intentional bundling of `NX_` variables. Deprecated in Nx 18. - **Cypress:** `cypressComponentConfiguration` generator removed from `@nx/cypress`, use `configurationGenerator`instead. Deprecated in Nx 16.8. - **Cypress:** `cypressProjectGenerator` generator removed from `@nx/cypress`, use `configurationGenerator` instead. Deprecated in Nx 15.9. - **Expo:** `withNxWebpack` removed from `@nx/expo`, use [metro bundler](https://docs.expo.dev/guides/customizing-metro/) (https://docs.expo.dev/guides/customizing-metro/) in app.json instead. There is a migration to handle this in Nx 19. Deprecated in Nx 15.8. ## Deferred to v20 - **JS:** `classProperties.loose` option removed from `@nx/js/babel` preset, use `loose` instead. Deprecated in Nx 17.0. - **ESLint:** Low priority task to "deviations from @typescript-eslint/recommended" for our lint rules. @JamesHenry will look at this later before Nx 20, but it is unimportant. - **React:** component testing does not work with Project Crystal, and we need the executor + built-in webpack configs to run CT. Will do a follow-up on this after Nx 19 release. Related issue: https://github.com/nrwl/nx/issues/21546 - **Next.js:** `withStylus` removal from `@nx/next`, use SASS instead. It hasn't worked, but we kept the file to throw an error when used. Deprecated in Nx 17.0. - **Next.js**: `@nx/next:component` and `@nx/next:page` generators to not derive the `components` and `app`/`pages` directory. Use `nx g @nx/next:component apps/myapp/components/button` instead. Deprecated in Nx 17.0. - **Webpack:** `isolatedConfig` option removal from `@nx/webpack:webpack` executor. There is a migration to handle this in Nx 19. Deprecated in in Nx 17.2. - **Angular:** `executeWebpackDevServerBuilder` removal from `@nx/angular/executors`, use `executeDevServerBuilder` instead. Deprecated in Nx 17.0.
73 lines
2.7 KiB
TypeScript
73 lines
2.7 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(v20): re-evalute these deviations from @typescript-eslint/recommended in v19 of Nx
|
|
*/
|
|
'no-extra-semi': 'off',
|
|
'@typescript-eslint/no-extra-semi': 'error',
|
|
'@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',
|
|
},
|
|
};
|