Code Monkey home page Code Monkey logo

Comments (7)

hacker112 avatar hacker112 commented on August 27, 2024

And here is by the way the .jscs.json-config that was used if that helps

{
    "excludeFiles": ["frontend/app/bower_components", "frontend/node_modules", "frontend/instrument",
                     "frontend/dist", "frontend/.tmp", "frontend/coverage",
                     "backend/node_modules", "backend/coverage"],
    "disallowKeywords": ["with"],
    "disallowKeywordsInComments": ["TODO"],
    "disallowKeywordsOnNewLine": ["else"],
    "disallowMixedSpacesAndTabs": true,
    "disallowMultipleLineStrings": true,
    "disallowNewlineBeforeBlockStatements": true,
    "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
    "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
    "disallowSpacesInCallExpression": true,
    "disallowSpacesInsideParentheses": true,
    "maximumLineLength": 120,
    "requireBlocksOnNewline": true,
    "requireCapitalizedConstructors": true,
    "requireCommaBeforeLineBreak": true,
    "requireDotNotation": "except_snake_case",
    "requireLineBreakAfterVariableAssignment": true,
    "requireOperatorBeforeLineBreak": true,
    "requireParenthesesAroundIIFE": true,
    "requireSpaceBeforeBlockStatements": true,
    "requireSpaceBeforeKeywords": ["else", "while", "catch"],
    "requireSpaceBeforeObjectValues": true,
    "requireSpaceBetweenArguments": true,
    "requireSpacesInConditionalExpression": true,
    "requireSpacesInForStatement": true,
    "validateLineBreaks": "LF",
    "validateParameterSeparator": ", ",
    "validateQuoteMarks": "'"
}

from brackets-jscs.

hacker112 avatar hacker112 commented on August 27, 2024

I have now found that the error is in handleJSXJSCS (Probably in JSXTransformer.transform(text, {harmony: true}).code;)

I added some console output to confirm this

console.log('text', text);
console.log('JSXCode', JSXCode);
return handleJSCS(JSXCode, fullPath, config);

Which gives the output:

text // This line has a trailing space 
function a() {
    return;
}
JSXCode // This line has a trailing spacefunction a() {
    return;
}

My workaround until it is fixed is to change line 189 in main.js to (since I do not use harmony I hope guess that JSXTransformer.transform is not necessary for me):

return handleJSCS(text, fullPath, config);

from brackets-jscs.

EvHaus avatar EvHaus commented on August 27, 2024

Looks like an issue with the JSXTransformer. I have opened a new bug with the Facebook team: facebook/react#3378

from brackets-jscs.

hacker112 avatar hacker112 commented on August 27, 2024

I think it is not JSXTransformer, but this line in handleJSXJSCS:

// Trim trailing whitespace
JSXCode = JSXCode.replace(/( +)\n/g, '');

If I remove it it works better.

Also Node-shebangs ( #!/usr/bin/env node\n ) are not handled correctly. It should be ignored if it is in the beginning of a file. I suggest the following in the beginning of the handleJSXJSCS-function:

text = text.replace(/^#!.+\n/m, '');

from brackets-jscs.

EvHaus avatar EvHaus commented on August 27, 2024

A fix has been pushed for this. Please try v0.2.2 of the extension.

from brackets-jscs.

hacker112 avatar hacker112 commented on August 27, 2024

The first problem is fixed now. But the other one is still a problem, I will create separate issue for that and a pull request.

from brackets-jscs.

hacker112 avatar hacker112 commented on August 27, 2024

Now you have a new problem. The rule:

{"disallowTrailingWhitespace": true}

does not work anymore. I will create a new issue for that.

from brackets-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.