The most recent version of aws-amplify was installed with npm. Additionally, npm init was run with the entrypoint file being 'entryPoint.js'. However, when I enter entryPoint.js and paste these lines of code at the top
import Amplify, {Auth} from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);
I receive a JSLint error that reads:
Expected an identifier and instead saw 'import'.
How can I correctly import aws-amplify? I followed instructions off of https://docs.amplify.aws/lib/auth/getting-started/q/platform/js#option-1-use-pre-built-ui-components
So JSLint is kinda new to the whole
importgame, and the instructions themselves say this aboutimport:For a long time, JSLint didn't (iirc) support
importat all, and then for a while maybe only with thees6jslint directive, but that's by memory. I'm glad to see it supports as much as it does now.And it looks like what that "small but essential subset" doesn't support is a default
importon the same line as a namedimport.But it does accept breaking that import into two lines like this:
JSLint is real big on making code easy to scan and read. Maybe the thinking is that you don't want both types on the same line b/c maybe you'll read
Amplifyas a named import? I don't know exactly in this case.But JSLint is a great tool to help ensure high quality JavaScript code. If you can get past its idiosyncrasies, like this one, it'll pay you back in the long term, though many will suggest for "modern" JavaScript code you should consider using eslint instead. It's a bit more configurable, which is itself a double-edged sword.