gund / eslint-plugin-deprecation

ESLint rule that reports usage of deprecated code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't find deprecation from library property (sequelize)

heidemn-faro opened this issue · comments

I read the comment before creating the issue, but I have a small hope that somebody can help me :-)

I have the following behavior:

  • VS Code correctly finds deprecations from the "sequelize" library (_attributes)
  • eslint-plugin-deprecation correctly finds deprecations inside our own codebase.
  • eslint-plugin-deprecation does not find the deprecation from "sequelize".
import { DataTypes, Model, ModelAttributeColumnOptions } from 'sequelize';

export class Dummy extends Model<IDummy, Partial<IDummy>> { ... }

// Model._attributes is deprecated.
export const dummyAttributes = (dataTypes: typeof DataTypes): ModelAttributes<Dummy, Dummy['_attributes']> => ({
    ...
});

tsconfig.json:

{
	"compilerOptions": {
		"target": "es2020",
		"module": "commonjs",
		"rootDir": "./",
		"outDir": "./build",
		"esModuleInterop": true,
		"strict": true,
		"allowSyntheticDefaultImports": true,
		"noImplicitAny": false,
		"resolveJsonModule": true,
		"experimentalDecorators": true,
		"emitDecoratorMetadata": true,
		"sourceMap": true
	}
}

The ESLint config is the same as your example in the README.

Hey, I think it's best if you can create a repro example online so everyone can clearly see which case does not work.

From your example it's a bit fuzzy to understand what exactly are you expecting to get reported as deprecated usage but if I were to guess it the Dummy['_attributes'] part from that?
If that's the case then I think it's a valid behavior as the library only reports deprecated code usage and not type usage which is what you are after.
So maybe when you will be using this type in your code later it would get marked as deprecated or not depending on how you are using it (as we already have a case where an object literal would not get reported).

So best case is to create a reproduction online and then we can figure out if this is a bug or intended behavior.