0

mod1.js

/**
 * Says hello.
 * @param  {String} name a name
 * @return {String}      a greeting for `name`
 */
export function sayHelloTo( name ) {
  const toSay = `Hello, ${name}!`;

  return toSay;
}

/**
 * Says goodbye.
 * @param  {String} name a name
 * @return {String}      a farewell for `name`
 */
export function sayGoodbyeTo( name ) {
  const toSay = `Later, ${name}!`;

  return toSay;
}

执行命令

wangle@DESKTOP-ANE8VEN MINGW32 /e/md-project/learn-rollup (master)
$ npm run rollup-build

> learn-rollup@1.0.0 rollup-build E:\md-project\learn-rollup
> rollup -c


E:\md-project\learn-rollup\src\scripts\modules\mod1.js
   7:15  error  Strings must use singlequote  quotes
   7:34  error  Strings must use singlequote  quotes
  18:15  error  Strings must use singlequote  quotes
  18:34  error  Strings must use singlequote  quotes

✖ 4 problems (4 errors, 0 warnings)

当我编译的时候报这个错,怎么解决阿?

查看全部 2 个回答

1

这不是它不识别的问题,是默认设置的问题;默认只识别单引号
可参见: http://eslint.cn/docs/2.0.0/r...
可以在对应的项目 .eslintrc.js 文件中进行修改;

如果需要用到像这样:let str = 'jeff\jade'(字符串中带有反斜杠)你应该再加一个反斜杠,予以转义。