Giter Site home page Giter Site logo

Comments (12)

brianmfear avatar brianmfear commented on June 15, 2024 2

My two cents: We should be able to write Aura code according to Aura documentation and get zero warnings. We're not following standards in Aura, because it's not defined to the standards, it's a special variant of JavaScript as far as I'm concerned. Also, traceability is not important, as it is transpiled anyways, easy to debug, and the trailing semi-colon is pointless and asymmetric. I already have over 23,000 PMD warnings that are actual code issues, I don't need another 10,000+ warnings cluttering up my list of things to fix. I'm pretty sure most orgs would rather ignore these warnings than fix them, and this means, if we turn off these warnings, we might miss real violations of these rules. Remember the story of the boy who cried wolf. We don't want to ignore the real wolves because of all the "fake" warnings.

from eslint-plugin-aura.

Szandor72 avatar Szandor72 commented on June 15, 2024 2

+1 for Brian that's exactly how I feel. Aura is special but that's no surprise.

My perfect solution would be: I install standard VS Code extensions for Salesforce, I create an Aura CMP, I copy stuff from docs and I get 0 problems in VS Code.

from eslint-plugin-aura.

touzoku avatar touzoku commented on June 15, 2024 1

I think it is better to keep the number of false positives to the minimum. So if some rule is producing noise, it is a good candidate for demotion.

Side topic:
@pmdartus is there any chance you know @rochejul or could meet in person? I think this plugin deserves a place in VSCode under /aura/ directory next to eslint-config-lwc.

from eslint-plugin-aura.

Szandor72 avatar Szandor72 commented on June 15, 2024 1

A working aura controller js gives me 58 Problems of which I understand a few, if at all.

I think it is better to keep the number of false positives to the minimum.

Agreed. If a working component comes from production or is copied from documentation and I get a lot of "Problems" this is just noise to me.

If nothing else, please explain your rationale in the documentation around the Tooling for the Salesforce VSCode Plugins. Please be mindful of the fact, that successful AURA Developers might not have any previous experience with Javascript Tooling and its current standards.

from eslint-plugin-aura.

rochejul avatar rochejul commented on June 15, 2024

Hi @touzoku

Basically, these warnings come from the fact we should not have anonymous function (to increase traceability on exception for example).

The code below could be converted to:

({
    'myAction': function myAction(component, event, helper) {
        return false
    }
})

And the warnings do not appear again (I use this format now and I have no warnings / errors).

An interesting feature could be to remove the following errors (from controllers, helpers, renderers...):

  1. "Expected an assignment or function call and instead saw an expression) on first line
  2. "Missing semicolon" on last line

What are your thoughts?

Regards

from eslint-plugin-aura.

rochejul avatar rochejul commented on June 15, 2024

I tried to align rules with the LWC plugin. So we should be careful.

Moreover, in this case, this is not really (on my point of view) noise, because this is hardly recommended to avoid anonymous function.

It depends if we want to have as much as much possible similar rules between LWC and Aura (most of the rules are not directly related to ES6 or LWC, but on most used coding guideline, like Airbnb).

I will let you to decide this point

Regards

from eslint-plugin-aura.

ntotten avatar ntotten commented on June 15, 2024

I'm digging into to this and seeing if we should change some of these default rules, but my general advice is that every team/company should have their own rules. Just use what works for you. It is easy to publish a shared config that your team can standardize on: https://eslint.org/docs/developer-guide/shareable-configs

from eslint-plugin-aura.

ntotten avatar ntotten commented on June 15, 2024

I think there are two things here.

Frist, the rules func-names and no-unused-expressions are probably aggressive. I am supportive of disabling them by default in VS Code to reduce the noise.

The second issue is a bit more complex. I get that you have a lot of warnings in an old codebase, but I don't really view this as a problem. What I would suggest is that you change your eslint rules to enforce the rules you want to actually use. Code written without ESLint is always going to have a bunch of issues when you enable it - both on and off the salesforce platform. I think there is value in encouraging developers to write more maintainable code by using ESLint, but is there value in rewriting a legacy codebase to fix warnings - probably not. In that case you should either disable ESLint or change your config to match your codebase.

from eslint-plugin-aura.

ntotten avatar ntotten commented on June 15, 2024

Proposed eslint rule change in templates: forcedotcom/salesforcedx-templates#186

from eslint-plugin-aura.

Szandor72 avatar Szandor72 commented on June 15, 2024

from eslint-plugin-aura.

jlawrence124 avatar jlawrence124 commented on June 15, 2024

Is there any update to this issue?

from eslint-plugin-aura.

pkozuchowski avatar pkozuchowski commented on June 15, 2024

Just stumbled on this, any updates? It's clearly a false positive in Aura controller/helper context

from eslint-plugin-aura.

Related Issues (12)

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.