ricardofbarros / semistandard-format

converts your code into SemiStandard JavaScript Format
28 stars 4 forks source link

additional semicolans in jsx #7

Open phaneendra opened 8 years ago

phaneendra commented 8 years ago

$ node -v v4.2.2

$ npm ls semistandard-format -g /Users/phaneendra/.nvm/v4.2.2/lib ├─┬ semistandard@7.0.4 │ └── semistandard-format@1.6.7 └── semistandard-format@2.1.0

$ semistandard-format -v 2.1.0

formating causes additional semicolans to be added to jsx syntax

source

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View
} = React;

var stint = React.createClass({
  render: function () {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.android.js
        </Text>
        <Text style={styles.instructions}>
          Shake or press menu button for dev menu
        </Text>
      </View>
    );
  }
});

After formating

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

var React = require('react-native');
var {AppRegistry, StyleSheet, Text, View} = React;

var stint = React.createClass({
  render: function () {
    return (
    <View style={styles.container;}>
      <Text style={styles.welcome;}>
        Welcome to React Native!
      </Text>
      <Text style={styles.instructions;}>
        To get started, edit index.android.js
      </Text>
      <Text style={styles.instructions;}>
        Shake or press menu button for dev menu
      </Text>
    </View>
    );
  }
});

This causes an issue with sublime linter SublimeLinter: semistandard output:

:20:40: Parsing error: Unexpected token ; (undefined) How to make jsx work with semistandard-format
gh0stonio commented 8 years ago

:+1:

gh0stonio commented 8 years ago

It seems to come from the esformatter-semicolons. If you desactivate it from the esformatter.json of the semi-standard module, after formatting you will not have the semicolons again.

I read some issues directly on esformatter-semicolons about it but i don't find anything to fix it :(

atapatel commented 8 years ago

+1 for this issue

fabiosantoscode commented 8 years ago

Cannot reproduce, has this been fixed by one of the dependencies or is it still an issue?

NikolayBorisov commented 8 years ago

It's still here only after "MemberExpression".

fabiosantoscode commented 8 years ago

The semi package this project depends on has been deprecated. Should I fork and fix this @ricardofbarros

ricardofbarros commented 8 years ago

Sure @fabiosantoscode I will happily accept an PR 😃