Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…n-import into issue2717/prefer-node-builtin-imports
  • Loading branch information
MikhailPertsev1 committed Jul 3, 2024
2 parents 75b48d3 + fc361a9 commit 6d345ba
Show file tree
Hide file tree
Showing 92 changed files with 3,034 additions and 1,876 deletions.
23 changes: 21 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"no-multiple-empty-lines": [2, { "max": 1, "maxEOF": 1, "maxBOF": 0 }],
"no-return-assign": [2, "always"],
"no-trailing-spaces": 2,
"no-use-before-define": [2, { "functions": true, "classes": true, "variables": true }],
"no-var": 2,
"object-curly-spacing": [2, "always"],
"object-shorthand": ["error", "always", {
Expand Down Expand Up @@ -211,10 +212,10 @@
"exports": "always-multiline",
"functions": "never"
}],
"prefer-destructuring": "warn",
"prefer-destructuring": "off",
"prefer-object-spread": "off",
"prefer-rest-params": "off",
"prefer-spread": "warn",
"prefer-spread": "off",
"prefer-template": "off",
}
},
Expand All @@ -227,6 +228,24 @@
"no-console": 1,
},
},
{
"files": [
"utils/**", // TODO
],
"rules": {
"no-use-before-define": "off",
},
},
{
"files": [
"resolvers/webpack/index.js",
"resolvers/webpack/test/example.js",
"utils/parse.js",
],
"rules": {
"no-console": "off",
},
},
{
"files": [
"resolvers/*/test/**/*",
Expand Down
155 changes: 155 additions & 0 deletions .github/workflows/native-wsl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: Native and WSL

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.configuration == 'wsl' && 'wsl-bash {0}' || 'pwsh' }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]
node-version: [18, 16, 14, 12, 10, 8, 6, 4]
configuration: [wsl, native]

steps:
- uses: actions/checkout@v4
- uses: Vampire/setup-wsl@v3
if: matrix.configuration == 'wsl'
with:
distribution: Ubuntu-22.04
- run: curl --version
- name: 'WSL: do all npm install steps'
if: matrix.configuration == 'wsl'
env:
ESLINT_VERSION: 7
TRAVIS_NODE_VERSION: ${{ matrix.node-version }}
run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install --latest-npm ${{ matrix.node-version }}
if [ ${{ matrix.node-version }} -ge 4 ] && [ ${{ matrix.node-version }} -lt 6 ]; then
npm install eslint@4 --no-save --ignore-scripts
npm install
npm install [email protected] --no-save
npm uninstall @angular-eslint/template-parser @typescript-eslint/parser --no-save
fi
if [ ${{ matrix.node-version }} -ge 6 ] && [ ${{ matrix.node-version }} -lt 7 ]; then
npm install eslint@5 --no-save --ignore-scripts
npm install
npm uninstall @angular-eslint/template-parser --no-save
npm install [email protected] @typescript-eslint/parser@3 --no-save
fi
if [ ${{ matrix.node-version }} -ge 7 ] && [ ${{ matrix.node-version }} -lt 8 ]; then
npm install eslint@6 --no-save --ignore-scripts
npm install
npm install [email protected] typescript-eslint-parser@20 --no-save
npm uninstall @angular-eslint/template-parser --no-save
fi
if [ ${{ matrix.node-version }} -eq 8 ]; then
npm install eslint@6 --no-save --ignore-scripts
npm install
npm uninstall @angular-eslint/template-parser --no-save
npm install @typescript-eslint/parser@3 --no-save
fi
if [ ${{ matrix.node-version }} -gt 8 ] && [ ${{ matrix.node-version }} -lt 10 ]; then
npm install eslint@7 --no-save --ignore-scripts
npm install
npm install @typescript-eslint/parser@3 --no-save
fi
if [ ${{ matrix.node-version }} -ge 10 ] && [ ${{ matrix.node-version }} -lt 12 ]; then
npm install
npm install @typescript-eslint/parser@4 --no-save
fi
if [ ${{ matrix.node-version }} -ge 12 ]; then
npm install
fi
npm run copy-metafiles
npm run pretest
npm run tests-only
- name: install dependencies for node <= 10
if: matrix.node-version <= '10' && matrix.configuration == 'native'
run: |
npm install --legacy-peer-deps
npm install eslint@7 --no-save
- name: Install dependencies for node > 10
if: matrix.node-version > '10' && matrix.configuration == 'native'
run: npm install

- name: install the latest version of nyc
if: matrix.configuration == 'native'
run: npm install nyc@latest --no-save

- name: copy metafiles for node <= 8
if: matrix.node-version <= 8 && matrix.configuration == 'native'
env:
ESLINT_VERSION: 6
TRAVIS_NODE_VERSION: ${{ matrix.node-version }}
run: |
npm run copy-metafiles
bash ./tests/dep-time-travel.sh 2>&1
- name: copy metafiles for Node > 8
if: matrix.node-version > 8 && matrix.configuration == 'native'
env:
ESLINT_VERSION: 7
TRAVIS_NODE_VERSION: ${{ matrix.node-version }}
run: |
npm run copy-metafiles
bash ./tests/dep-time-travel.sh 2>&1
- name: install ./resolver dependencies in Native
if: matrix.configuration == 'native'
shell: pwsh
run: |
npm config set package-lock false
$resolverDir = "./resolvers"
Get-ChildItem -Directory $resolverDir |
ForEach {
Write-output $(Resolve-Path $(Join-Path $resolverDir $_.Name))
Push-Location $(Resolve-Path $(Join-Path $resolverDir $_.Name))
npm install
npm ls nyc > $null;
if ($?) {
npm install nyc@latest --no-save
}
Pop-Location
}
- name: run tests in Native
if: matrix.configuration == 'native'
shell: pwsh
run: |
npm run pretest
npm run tests-only
$resolverDir = "./resolvers";
$resolvers = @();
Get-ChildItem -Directory $resolverDir |
ForEach {
$resolvers += "$(Resolve-Path $(Join-Path $resolverDir $_.Name))";
}
$env:RESOLVERS = [string]::Join(";", $resolvers);
foreach ($resolver in $resolvers) {
Set-Location -Path $resolver.Trim('"')
npm run tests-only
Set-Location -Path $PSScriptRoot
}
- name: codecov
uses: codecov/[email protected]

windows:
runs-on: ubuntu-latest
needs: [build]
steps:
- run: true
16 changes: 13 additions & 3 deletions .github/workflows/node-4+.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: 'Tests: node.js'

on: [pull_request, push]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

Expand All @@ -22,11 +26,14 @@ jobs:
latest:
needs: [matrix]
name: 'majors'
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
eslint:
- 8
Expand All @@ -38,16 +45,19 @@ jobs:
- 2
include:
- node-version: 'lts/*'
os: ubuntu-latest
eslint: 7
ts-parser: 4
env:
TS_PARSER: 4
- node-version: 'lts/*'
os: ubuntu-latest
eslint: 7
ts-parser: 3
env:
TS_PARSER: 3
- node-version: 'lts/*'
os: ubuntu-latest
eslint: 7
ts-parser: 2
env:
Expand Down Expand Up @@ -99,7 +109,7 @@ jobs:
eslint: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@main
continue-on-error: ${{ matrix.eslint == 4 && matrix.node-version == 4 }}
name: 'nvm install ${{ matrix.node-version }} && npm install, with eslint ${{ matrix.eslint }}'
Expand All @@ -113,7 +123,7 @@ jobs:
skip-ls-check: true
- run: npm run pretest
- run: npm run tests-only
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v3.1.5

node:
name: 'node 4+'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node-pretest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - uses: ljharb/actions/node/install@main
# name: 'nvm install lts/* && npm install'
# with:
Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@main
name: 'nvm install lts/* && npm install'
with:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: 'Tests: packages'

on: [pull_request, push]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

Expand Down Expand Up @@ -38,7 +42,7 @@ jobs:
# - utils

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
env:
Expand All @@ -50,7 +54,7 @@ jobs:
after_install: npm run copy-metafiles && ./tests/dep-time-travel.sh && cd ${{ matrix.package }} && npm install
skip-ls-check: true
- run: cd ${{ matrix.package }} && npm run tests-only
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v3.1.5

packages:
name: 'packages: all tests'
Expand Down
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 6d345ba

Please sign in to comment.