Skip to content

novavovikov/deprecated-code-loader

Repository files navigation

npm node size tests

deprecated-loader

The deprecated-loader notifies deprecated code.

Getting Started

To begin, you'll need to install deprecated-loader:

$ npm install deprecated-loader --save-dev

Then add the loader to your webpack config. For example:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/i,
        use: [
          {
            loader: 'deprecated-loader'
          }
        ]
      }
    ]
  }
}

Use comment @deprecated [2.0.0] in your code. In square brackets, indicate the version after which the code should be removed:

file.js

/**
 * @deprecated [2.0.0]
 */
console.log('Some code')

And run webpack via your preferred method. If the version of the app in package.json is greater than or equal to the version of the code, you will see comments in the terminal:

WARNING in ./file.js
Module Warning (from ./file.js):

----------------
line: 13
text: @deprecated [2.0.0]
----------------

Options

notification

Enum: warning|error|none - default: 'warning'

Deprecated code notification type

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/i,
        use: [
          {
            loader: 'deprecated-loader',
            options: {
              notification: 'error'
            }
          }
        ]
      }
    ]
  }
}

License

MIT

About

The deprecated-loader notifies about deprecated code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published