Sorry for repeating the question, but I am a rookie and didn't understand how to solve this problem. Please, if it is not difficult, describe in more detail how to solve this problem.
I'm creating my learning project using the 2017 textbook and there were no such errors in that code. I can't find the problem on my own due to my inexperience in such complex projects.
const gulp = require ('gulp') ;
const babel = require('gulp-babel');
const eslint = require('gulp-eslint');
// Задание для gulp - инструмент сборки.
gulp.task('default', async function ()
{
// Запуск ESLint
gulp.src(["es6/**/*.js", "public/es6/**/*.js"])
.pipe(eslint())
.pipe(eslint.format());
// Указание для node.js
// Указание кода источника для сборки.
gulp.src("es6/**/*.js")
// Транспортировка(pipe) файлов исходного кода в Babel, который преобразует их из ЕSб в ES5.
.pipe(babel())
// На завершающем этапе откомпилированный код ES5 транспортируется по назначению, в каталог dist.
.pipe(gulp.dest("dist"));
// Указание для браузера.
// Указание кода источника для сборки.
gulp.src("public/es6/**/*.js")
// Вызов транскриптора для кода.
.pipe(babel())
//На завершающем этапе откомпилированный код ESS транспортируется по назначению, в каталог dist.
.pipe(gulp.dest("public/dist"));
});
package:
{
"name": "javascriptproject",
"version": "1.0.0",
"description": "myProject",
"main": "main.js",
"directories": {
"test": "test"
},
"dependencies": {
"gulp-eslint": "^6.0.0",
"save-dev": "0.0.1-security",
"underscore": "^1.13.1"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/preset-react": "^7.14.5",
"babel-preset-es2015": "^6.24.1",
"eslint": "^7.29.0",
"eslint-plugin-react": "^7.24.0",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "D:\\JavaScriptProject"
},
"keywords": [
"my",
"first",
"project"
],
"author": "me",
"license": "ISC"
}
.eslintrc:
module.exports = {
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
}
};
I've got it after some changes in
"es2021": true, into "es2020": true,
Parsing error: Invalid ecmaVersion
I've changed"ecmaVersion": 12
,into "ecmaVersion": 11
,I'm not sure if this really works, but it looks like it: