Coder Social home page Coder Social logo

a-tarasyuk / eslint-plugin-redundant-undefined Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 0.0 830 KB

ESlint rule for disallow redundant undefined

License: MIT License

JavaScript 2.05% TypeScript 97.95%
eslint eslint-plugin eslint-plugin-redundant-undefined typescript-eslint

eslint-plugin-redundant-undefined's Introduction

eslint-plugin-redundant-undefined's People

Contributors

a-tarasyuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eslint-plugin-redundant-undefined's Issues

`followExactOptionalPropertyTypes` option is not meaningful

Using "exactOptionalPropertyTypes": true means that the semantics of a?: number | undefined are different from a?: number. It does not mean that | undefined must be included in every place where an optional parameter is declared.

error Property is optional, so undefined must be included in the type

Using the followExactOptionalPropertyTypes option of the plugin behaves as-if we are required to declare every optional variable with | undefined -- which doesn't make sense. The plugin should simply not be used (or it should refuse to work or not do anything) with the exactOptionalPropertyTypes tsconfig option, because every presence or lack of | undefined is semantically valid.

Should work with @typescript-eslint/parser >= 5 as well

I would love to use this in my project building a library but unfortunately this eslint plugin is not compatible with newer versions of @typescript-eslint/parser starting from 5.0. Error message is

> eslint .


Oops! Something went wrong! :(

ESLint: 8.1.0

TypeError: Failed to load plugin 'redundant-undefined' declared in '.eslintrc': Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/Users/schmida/work/customer/son/fe-repo/node_modules/eslint-plugin-redundant-undefined/node_modules/@typescript-eslint/experimental-utils/dist/ts-eslint/CLIEngine.js:12:34)
    at Module._compile (/Users/schmida/work/customer/son/fe-repo/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (/Users/schmida/work/customer/son/fe-repo/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/Users/schmida/work/customer/son/fe-repo/node_modules/eslint-plugin-redundant-undefined/node_modules/@typescript-eslint/experimental-utils/dist/ts-eslint/index.js:14:14)
    at Module._compile (/Users/schmida/work/customer/son/fe-repo/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.