question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parse Error: Illegal import declaration. React Native project

See original GitHub issue

Tell us about your environment 2017-04-26 15 52 12

  • ESLint Version: v3.19.0
  • Node Version: v7.9.0
  • npm Version: 4.2.0 What parser (default, Babel-ESLint, etc.) are you using? babel-eslint Please show your full configuration:
    "extends"       : "airbnb",
    "parser"        : "babel-eslint",
    "parserOptions" : {
        "ecmaVersion"  : 6,
        "sourceType"   : "module",
    },
    "ecmaFeatures" : {
        "jsx": true,
        "modules": true, 
    },
    "env": {
        "browser" : true,
        "node"    : true,
        "jquery"  : true,
    },
    "settings":{
            "react":{
            "pragma":"React",
            "version":"15.1.0"
            },
        "ecmascript":6,
        "jsx":true
    },
    "plugins": [
        "react",
        "react-native"
    ],
    "rules": {
        "strict": 0,
        "quotes": 0,
        "no-unused-vars": 1,
        "camelcase": 1,
        "no-underscore-dangle": 1,
        "comma-dangle":[1,"never"],
        "indent":["error",4],
        "react/jsx-indent":0,
        "react/jsx-equals-spacing": [2, "always"],
        "no-console":0,
        "max-len":1,
        "no-param-reassign":1,
        "key-spacing": [
              2,
        {
                "align": "colon",
                "beforeColon": true,
                "afterColon": true
        }
        ],
        "no-multi-spaces": [
              2,
        {
                "exceptions":{
                    "VariableDeclarator":true,
                    "ImportDeclaration":true,
                    "JSXAttribute":true,
                    "AssignmentExpression":true
                }
        }
        ]
    }
}

What did you do? Please include the actual source code causing the issue.

import React, { Component } from 'react'

What did you expect to happen? I want to make no mistake

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
platinumazurecommented, Apr 26, 2017

@gHashTag Might be worth running ./node_modules/bin/eslint.js --print-config path/to/file.js so that you can see if a different configuration file is interfering.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parse Error: Line 1: Illegal import declaration - Stack Overflow
I looked online and it appears that the import statement is not recognised unless I use Babel. However, from what I understand, with...
Read more >
[Solved]-Parse Error: Line 1: Illegal import declaration-babel.js
Create React App uses both Webpack and Babel under the hood. As the current browsers don't support the import statement, you have to...
Read more >
React.js JSX files import - Google Groups
I am using sbt-reactjs to compile JSX files used by react.js framework. ... error[Parse Error: Line 1: Illegal import declaration].
Read more >
SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >
Top 6 Ways To Fix Illegal Start Of Expression Error In Java
Recheck the syntax as well. Always look for the root cause of the error and always recompile every time you fix a bug...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found