Coder Social home page Coder Social logo

Comments (16)

beefancohen avatar beefancohen commented on May 9, 2024 2

Just published v1.0.2 let me know if you face any other issues. I'm going to work on better error handling right now for every rule.

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 9, 2024 1

sure, perhaps with the filename and line number

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 9, 2024 1

thanks @ivarni will get you a fix for that right now and work on error handling today.

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 9, 2024 1

Fixed ConditionalExpression handler in v1.0.4

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 9, 2024

Yeah, it should be more fault tolerant than that 😦

Mind sharing the JSX that was used so I can add a handler for a ThisExpression

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 9, 2024

I have no idea - I ran it on our huge codebase and it doesn't tell me which file it's looking at :-/

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 9, 2024

Ah, that's okay, I've created a function to handle ThisExpression. I'm actually not sure if the code should be more defensive because it could return false positives. In your experience would it be better for the code to fail so user can report a bug or fail gracefully even if it incorrectly warns?

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 9, 2024

I'd say it'd be better for it to fail with a meaningful error message.

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 9, 2024

as in an actual throw new Error(``Encountered an unknown type '${type}' while trying to get the prop ${prop}'s value. Please file an issue on Github to get this resolved immediately.``) ??

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 9, 2024

@evcohen not to put too much pressure on you, but this is blocking release of v8 of eslint-config-airbnb ;-) is it something you hope to get out soon?

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 9, 2024

ah working on it now, sorry about that. will let you know when im about to publish.

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 9, 2024

actually, let me just get a fix out for ThisExpression and then add error handling for next release. might take some time to figure out how to get propagate certain values to that function to give a meaningful error message.

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 9, 2024

Thanks!

from eslint-plugin-jsx-a11y.

ivarni avatar ivarni commented on May 9, 2024

@evcohen I just got this error with version 1.0.3 for the rule "jsx-a11y/aria-proptypes"

In our code base I found this:

<input
    aria-invalid={error ? 'true' : 'false'}
>

Removing the aria-invalid property made the error go away, so if you want to work on error-handling that will at least give you something that throws.

from eslint-plugin-jsx-a11y.

DanCech avatar DanCech commented on May 9, 2024

I'm still seeing this error with v1.0.4, the line of source that's triggering it is:

<div className="download__logo float-left"><img src={'/api/plugins/' + plugin.slug + '/logos/small'} alt={plugin.name + ' Logo'} /></div>

expression is:

Node {
  type: 'BinaryExpression',
  start: 1047,
  end: 1068,
  loc:
   SourceLocation {
     start: Position { line: 25, column: 116 },
     end: Position { line: 25, column: 137 } },
  left:
   Node {
     type: 'MemberExpression',
     start: 1047,
     end: 1058,
     loc: SourceLocation { start: [Object], end: [Object] },
     object:
      Node {
        type: 'Identifier',
        start: 1047,
        end: 1053,
        loc: [Object],
        name: 'plugin',
        range: [Object],
        _babelType: 'Identifier' },
     property:
      Node {
        type: 'Identifier',
        start: 1054,
        end: 1058,
        loc: [Object],
        name: 'name',
        range: [Object],
        _babelType: 'Identifier' },
     computed: false,
     range: [ 1047, 1058 ],
     _babelType: 'MemberExpression' },
  operator: '+',
  right:
   Node {
     type: 'Literal',
     start: 1061,
     end: 1068,
     loc: SourceLocation { start: [Object], end: [Object] },
     extra: { rawValue: ' Logo', raw: '\' Logo\'' },
     value: ' Logo',
     range: [ 1061, 1068 ],
     _babelType: 'StringLiteral',
     raw: '\' Logo\'' },
  range: [ 1047, 1068 ],
  _babelType: 'BinaryExpression' }

And sure enough, BinaryExpression isn't a key in TYPES.

Changing that line to use a template literal "fixes" the problem:

<div className="download__logo float-left"><img src={'/api/plugins/' + plugin.slug + '/logos/small'} alt={`${plugin.name} Logo`} /></div>

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 9, 2024

@DanCech published v1.1.0 with BinaryExpression handler and basic error handling when getting an unknown expression type. Thanks for reporting 😄

from eslint-plugin-jsx-a11y.

Related Issues (20)

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.