Giter Site home page Giter Site logo

Comments (22)

mdevils avatar mdevils commented on June 24, 2024

Reasonable. But due to Syntax Tree Structure, I have no good ideas how to implement. But you can try :)

from node-jscs.

kaero avatar kaero commented on June 24, 2024

May be useful: https://code.google.com/p/esprima/issues/detail?id=197

from node-jscs.

kaero avatar kaero commented on June 24, 2024

@mdevils I has reviewed this issue and has found that comments' array contains locations of the comments, so we can found all comments for BlockStatements, parse these comments and set temporary options for checks.

from node-jscs.

mdevils avatar mdevils commented on June 24, 2024

Yeah, I see. It is possible. The thing is that I can't find good, easy solution for implementing this in the current rule behavior.

from node-jscs.

mdevils avatar mdevils commented on June 24, 2024

Got an easy implementation idea.

I suggest these regions: /* jscs: off */ -- /* jscs: on */.

from node-jscs.

kaero avatar kaero commented on June 24, 2024

Am i right that you propose to turn on/off jscs at all for region?

from node-jscs.

mdevils avatar mdevils commented on June 24, 2024

Yep.

from node-jscs.

Krinkle avatar Krinkle commented on June 24, 2024

See also #223 (requests inline configuration in general, as opposed to just disabling everything).

This seems especially needed in case one is dealing with an upstream interface. For example, enforcing camel case identifiers and properties but encountering something like unicodeSpec.Regional_Indicator.

I'm referencing #102 as this is somewhat of a regression when coming from JSHint as migrating from camelcase: true to requireCamelCaseOrUpperCaseIdentifiers: true is problematic if /*jshint camelcase:false */ doesn't have an equivelent.

from node-jscs.

kangax avatar kangax commented on June 24, 2024

Ran into this well when referencing third-party "G_vmlCanvasManager" (from excanvas.js), which doesn't satisfy camelcase, otherwise enforced in our project.

+1

from node-jscs.

kangax avatar kangax commented on June 24, 2024

Another way to allow for 3rd-party exceptions like G_vmlCanvasManager is by having a whitelist in config; similar to JSHint's "globals":

{
  requireCamelCaseOrUpperCaseIdentifiers: true,
  identifierCaseExceptions: [ 'G_vmlCanvasManager', '...' ]
}

or even:

{
  requireCamelCaseOrUpperCaseIdentifiers: [ 'G_vmlCanvasManager', '...' ]
}

..although this might be too confusing.

from node-jscs.

nschonni avatar nschonni commented on June 24, 2024

@kangax I like the approach, but maybe

requireCamelCaseOrUpperCaseIdentifiers: {
    ignore: [ 'G_vmlCanvasManager', '...' ]
}

The first way would require a second rule, and the second is a little confusing since it seems like you are trying to enforce the camel casing on the exceptions.

from node-jscs.

NickHeiner avatar NickHeiner commented on June 24, 2024

This seems especially needed in case one is dealing with an upstream interface. For example, enforcing camel case identifiers and properties but encountering something like unicodeSpec.Regional_Indicator.

I have this issue as well. I think it would be nicer to just be able to turn off specific rules (or jscs checking entirely) for certain regions - having to put this stuff in the config requires the developer to be aware of more places in the code at once.

from node-jscs.

donaldpipowitch avatar donaldpipowitch commented on June 24, 2024

+1

I need this for calls to a different library.

from node-jscs.

dentuzhik avatar dentuzhik commented on June 24, 2024

Why not to comply with jshint in such case?
From jshint docs

// Code here will be linted with JSHint.
/* jshint ignore:start */
// Code here will be linted with ignored by JSHint.
/* jshint ignore:end */

ignoreThis(); // jshint ignore:line

Would be much better to have a common api between similar tools.

/* jscs ignore:start */
/* jscs ignore:end */
// jscs ignore:line

from node-jscs.

Kienz avatar Kienz commented on June 24, 2024

#20 (comment) +1

from node-jscs.

MattiSG avatar MattiSG commented on June 24, 2024

+1 for interaction with external library

from node-jscs.

laurelnaiad avatar laurelnaiad commented on June 24, 2024

+1 -- would like to have some way to ignore ala /* jshint ignore:start/end */

from node-jscs.

dsuckau avatar dsuckau commented on June 24, 2024

I need this too, for the use of an external library.... I prefer the inline comments like in JSHint and ESLint too.

from node-jscs.

mikesherov avatar mikesherov commented on June 24, 2024

This is fixed in fa5527a and will be release with version 1.6.0!

from node-jscs.

MattiSG avatar MattiSG commented on June 24, 2024

Great, thanks! :)

Le 3 août 2014 à 02:02, Mike Sherov [email protected] a écrit :

This is fixed in fa5527a and will be release with version 1.6.0!


Reply to this email directly or view it on GitHub.

from node-jscs.

kangax avatar kangax commented on June 24, 2024

@mikesherov thanks! any idea when you'll be tagging 1.6.0?

from node-jscs.

markelog avatar markelog commented on June 24, 2024

any idea when you'll be tagging 1.6.0?

Should happen on this week

from node-jscs.

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.