Can I have a special project abandonment message using eslint?

I have a project node.jsthat checks itself for compliance with the code in accordance with the rules specified in .eslintrc, using gulpand gulp-eslint.

Now, I would like it to generate special failure warnings when it encounters a specific require:

const someModule = require('myDeprecatedModule');
// Warning: myDeprecatedModule is deprecated. Use myNewModule in stead.

Is this possible in a simple way that the IDE will also accept?

  • Using .eslint
  • No custom plugin to publish and install with npm
  • Only local code that can be ported to the repository, nothing global
  • No custom code in node_modules
+4
source share
1 answer

no-restricted-modules : .

. , myDeprecatedModule, .eslintrc "rules".

"no-restricted-modules": ["error", "myDeprecatedModule"]

, . .

+4

Source: https://habr.com/ru/post/1667880/


All Articles