Fix bug 1697462, update node dependencies (#1895)

* Bug 1697462, update node dependencies

* Update babel and eslint

* Fix more references to lint-frontend

* Get make test to work again

* npm update

* yarn upgrade

* browserslist --update-db

* yarn upgrade react-scripts --latest

* Remove last Translate.Next in Makefile

* yarn upgrade tlds --latest

* yarn upgrade sinon --latest

* yarn upgrade enzyme-adapter-react-16 --latest

* Use yarn in workflow to stick to pinned versions

* Install top-level, too, as that has @babel/eslint-parser
This commit is contained in:
Axel Hecht 2021-03-17 18:18:09 +01:00 коммит произвёл GitHub
Родитель f245ebff85
Коммит c349a272e5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 9829 добавлений и 13429 удалений

Просмотреть файл

@ -1,5 +1,6 @@
{
"presets": [
"@babel/preset-flow",
"@babel/preset-env",
"@babel/preset-react"
],

Просмотреть файл

@ -8,7 +8,7 @@ module.exports = {
browser: true,
jest: true,
},
parser: "babel-eslint",
parser: "@babel/eslint-parser",
parserOptions: {
ecmaVersion: 2017,
ecmaFeatures: {
@ -16,6 +16,9 @@ module.exports = {
experimentalObjectRestSpread: true
},
sourceType: 'module',
babelOptions: {
configFile: __dirname + "/.babelrc",
},
},
globals: {
gettext: false,
@ -76,4 +79,9 @@ module.exports = {
"no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": true }],
"no-console": 1,
},
settings: {
'react': {
'version': 'detect'
}
}
};

8
.github/workflows/frontend.yml поставляемый
Просмотреть файл

@ -23,14 +23,16 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
- name: Root install
run: npm install
- name: Install dependencies
run: yarn
working-directory: frontend
- name: flow
run: npm run flow
run: yarn flow
working-directory: frontend
- name: build
run: npm run build
run: yarn build
working-directory: frontend
jest:

2
.github/workflows/js-lint.yml поставляемый
Просмотреть файл

@ -34,7 +34,7 @@ jobs:
- name: Install dependencies
run: npm install
- name: eslint
run: ./node_modules/.bin/eslint .
run: npm run eslint
prettier:
name: prettier

Просмотреть файл

@ -1,6 +1,7 @@
# minified code
*.min.js
*.min.css
frontend/build
# libraries
**/base/static/js/lib*

Просмотреть файл

@ -141,7 +141,7 @@ Additionally, there are linting rules that are defined in our
.. code-block:: shell
$ make lint-frontend
$ make eslint
In the rare case when you cannot fix an eslint error, use ``// eslint-disable`` to make the linter
ignore that error. Note that in most cases, it is better to fix the issues than ignore them.

Просмотреть файл

@ -9,7 +9,7 @@ SITE_URL ?= http://localhost:8000
USER_ID?=1000
GROUP_ID?=1000
.PHONY: build setup run clean shell test test-frontend jest pytest flake8 black prettier check-prettier format flow lint-frontend dumpdb loaddb build-frontend build-frontend-w sync-projects requirements
.PHONY: build setup run clean shell test test-frontend jest pytest flake8 black prettier check-prettier format flow eslint dumpdb loaddb build-frontend build-frontend-w sync-projects requirements
help:
@echo "Welcome to Pontoon!\n"
@ -20,8 +20,8 @@ help:
@echo " clean Forces a rebuild of docker containers"
@echo " shell Opens a Bash shell in a webapp docker container"
@echo " test Runs the entire test suite (back and front)"
@echo " test-frontend Runs the new frontend's test suite (Translate.Next)"
@echo " jest Runs the jest test runner on all Translate.Next tests"
@echo " test-frontend Runs the new frontend's test suite"
@echo " jest Runs the jest test runner on all frontend tests"
@echo " pytest Runs the backend's test suite (Python)"
@echo " flake8 Runs the flake8 style guides on all Python code"
@echo " black Runs the black formatter on all Python code"
@ -29,7 +29,7 @@ help:
@echo " check-prettier Runs a check for format issues with the prettier formatter"
@echo " format Runs formatters for both the frontend and Python code"
@echo " flow Runs the Flow type checker on the frontend code"
@echo " lint-frontend Runs a code linter on the frontend code (Translate.Next)"
@echo " eslint Runs a code linter on the JavaScript code"
@echo " dumpdb Create a postgres database dump with timestamp used as file name"
@echo " loaddb Load a database dump into postgres, file name in DB_DUMP_FILE"
@echo " build-frontend Builds the frontend static files"
@ -90,8 +90,8 @@ format:
make pyupgrade
make black
lint-frontend:
"${DC}" run --rm -w //app/frontend webapp ./node_modules/.bin/eslint src/
eslint:
"${DC}" run --rm webapp npm run eslint
shell:
"${DC}" run --rm webapp //bin/bash

Просмотреть файл

@ -11,7 +11,6 @@ BLACK="$(which black)"
FLAKE8="$(which flake8)"
NPM="$(which npm)"
PYTEST="$(which pytest)"
CODECOV="$(which codecov)"
echo ""
@ -29,12 +28,12 @@ $FLAKE8 pontoon/
echo ""
echo "--------------------------------------------------------------------------------------------"
echo "Formatting Javascript code"
./node_modules/.bin/prettier --check '**/frontend/**/*.{js,css}' '**/pontoon/**/*.{js,css}' '**/tests/**/*.{js,css}'
npm run check-prettier
echo ""
echo "Linting JavaScript code"
./node_modules/.bin/eslint .
npm run eslint
echo ""
@ -48,6 +47,9 @@ echo ""
echo "--------------------------------------------------------------------------------------------"
echo "Running JavaScript tests"
$NPM test
pushd frontend
yarn test --watchAll=false
popd
echo ""

Просмотреть файл

@ -32,7 +32,7 @@
"react-redux": "7.1.3",
"react-router": "5.2.0",
"react-router-dom": "5.2.0",
"react-scripts": "3.4.0",
"react-scripts": "4.0.3",
"react-tabs": "3.0.0",
"react-time-ago": "5.0.4",
"reactour": "1.15.1",
@ -44,7 +44,7 @@
"slate": "0.58.4",
"slate-react": "0.58.4",
"styled-components": "4.3.2",
"tlds": "1.203.1"
"tlds": "1.218.0"
},
"scripts": {
"start": "react-scripts start",
@ -57,7 +57,7 @@
"devDependencies": {
"chokidar-cli": "2.1.0",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.2",
"sinon": "7.3.1"
"enzyme-adapter-react-16": "1.15.6",
"sinon": "9.2.4"
}
}

Просмотреть файл

@ -30,7 +30,7 @@ export function _isTranslator(
return true;
}
if (user.translatorForProjects.hasOwnProperty(localeProject)) {
if (Object.hasOwnProperty.call(user.translatorForProjects, localeProject)) {
return user.translatorForProjects[localeProject];
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

14943
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -24,7 +24,8 @@
"build-w": "webpack -w",
"heroku-postbuild": "echo Build is taken care of in ./bin/post_compile",
"prettier": "prettier --write '**/frontend/**/*.{js,css}' '**/pontoon/**/*.{js,css}' '**/tests/**/*.{js,css}'",
"check-prettier": "prettier --check '**/frontend/**/*.{js,css}' '**/pontoon/**/*.{js,css}' '**/tests/**/*.{js,css}'"
"check-prettier": "prettier --check '**/frontend/**/*.{js,css}' '**/pontoon/**/*.{js,css}' '**/tests/**/*.{js,css}'",
"eslint": "eslint 'frontend/**/*.js' 'pontoon/**/*.js' 'tests/**/*.js'"
},
"jest": {
"testMatch": [
@ -56,35 +57,36 @@
]
},
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.5.5",
"babel-eslint": "^8.2.6",
"babel-loader": "^8.0.6",
"@babel/cli": "^7.13.10",
"@babel/core": "^7.13.10",
"@babel/eslint-parser": "^7.13.10",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/preset-flow": "^7.12.13",
"@babel/preset-react": "^7.12.13",
"@babel/runtime": "^7.13.10",
"babel-loader": "^8.2.2",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"css-loader": "^3.1.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^4.19.1",
"eslint-plugin-react": "^7.10.0",
"css-loader": "^3.6.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^7.22.0",
"eslint-plugin-react": "^7.22.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.8.0",
"jest": "^24.9.0",
"jsdom": "^11.12.0",
"mini-css-extract-plugin": "^0.4.1",
"mini-css-extract-plugin": "^0.4.5",
"prettier": "2.2.0",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-table": "^6.8.6",
"react-test-renderer": "^16.4.2",
"request": "^2.87.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-table": "^6.11.5",
"react-test-renderer": "^16.14.0",
"request": "^2.88.2",
"style-loader": "^0.19.1",
"webpack": "^4.36.1",
"webpack-bundle-tracker": "^0.4.2-beta",
"webpack-cli": "^3.1.1",
"webpack": "^4.46.0",
"webpack-bundle-tracker": "^0.4.3",
"webpack-cli": "^3.3.12",
"yuglify": "^2.0.0"
},
"prettier": {

Просмотреть файл

@ -1,4 +1,3 @@
/* global $ */
$(function () {
var container = $('#main .container');