rsnext/test-pnp.sh
Houssein Djirdeh e5ef60fecb
Add ESLint to Next.js (#22437)
For #22228

This PR:

- Adds ESLint to toolchain
  - Included by default for builds (`next build`)
  - Can be enabled for development (`next dev`)
  - Custom formatter built for output
- Adds appropriate tests
- Adds two documentation pages
2021-03-23 21:32:42 +00:00

46 lines
918 B
Bash
Executable file

declare -a testCases=(
# Tests the webpack require hook
"progressive-web-app"
"with-typescript"
"with-next-sass"
# Tests @next/mdx
"with-mdx"
# Tests babel config
"with-styled-components"
)
set -e
set -x
# Speeds up testing locally
export CI=1
rm -rf ./e2e-tests
initialDir=$(pwd)
for testCase in "${testCases[@]}"
do
cd $initialDir
echo "--- Testing $testCase ---"
mkdir -p "./e2e-tests/$testCase"
cp -r "./examples/$testCase/." "./e2e-tests/$testCase"
cd "./e2e-tests/$testCase"
# Ensure builds do not fail due to lint errors
echo "module.exports = { eslint: { build: false } }" > next.config.js
touch yarn.lock
yarn set version berry
# Temporary fix for https://github.com/yarnpkg/berry/issues/2514:
yarn set version from sources
yarn config set pnpFallbackMode none
yarn config set enableGlobalCache true
yarn link --all --private -r ../..
yarn build
done