Comments (22)
Reasonable. But due to Syntax Tree Structure, I have no good ideas how to implement. But you can try :)
from node-jscs.
May be useful: https://code.google.com/p/esprima/issues/detail?id=197
from node-jscs.
@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.
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.
Got an easy implementation idea.
I suggest these regions: /* jscs: off */
-- /* jscs: on */
.
from node-jscs.
Am i right that you propose to turn on/off jscs at all for region?
from node-jscs.
Yep.
from node-jscs.
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.
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.
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.
@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.
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.
+1
I need this for calls to a different library.
from node-jscs.
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.
from node-jscs.
+1 for interaction with external library
from node-jscs.
+1 -- would like to have some way to ignore ala /* jshint ignore:start/end */
from node-jscs.
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.
This is fixed in fa5527a and will be release with version 1.6.0!
from node-jscs.
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.
@mikesherov thanks! any idea when you'll be tagging 1.6.0?
from node-jscs.
any idea when you'll be tagging 1.6.0?
Should happen on this week
from node-jscs.
Related Issues (20)
- jscs exlucdeFiles not Work! HOT 1
- Should have exception for disallowSpacesInFunction for anonymous generators HOT 1
- not possible to include extensions with multiple "." characters HOT 7
- Error running rule requirePaddingNewLinesBeforeLineComments HOT 1
- not possible to ignore '.js' files with fileExtensions #2273
- Destructuring with default values in parameters throws an error. HOT 1
- Cannot find module 'babel-runtime/core-js/object/keys' HOT 8
- Error: Symbol is not defined (first character of file) HOT 3
- Add `templateStrings` as an option for the `allExcept` property of the `maximumLineLength` rule HOT 2
- requireSpaceBeforeDestructuredValues does not work in vanilla JS HOT 3
- maximumLineLength should optionally allow string literals to break the rule HOT 2
- validateIndentation should enforce endbrace at the same indentation as the line containing it's corresponding startbrace HOT 2
- Error running rule requireDollarBeforejQueryAssignment HOT 3
- JSCS goes into infinite loop HOT 2
- About jsx curly braces variable HOT 1
- JSCS crashes due to decorators HOT 1
- requireSpaceBetweenArguments doesn't work in constructor of es6. HOT 4
- How to write a rule which makes "case" align to "switch" in switch statement? HOT 1
- jscs.info offline HOT 3
- Disabling Specific Rules For a Single Line not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-jscs.