Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(allow-scripts): update types #649

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ packages/perf/trials/**/*
packages/survey/mitm/**/*
packages/viz/dist/**/*
packages/viz/src/example-policies/**/*
packages/yarn-plugin-allow-scripts/bundles
36 changes: 35 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ module.exports = {
// messing with this, so we need to set it manually.
// https://eslint.org/docs/latest/use/configure/language-options#specifying-environments
ecmaVersion: 12,

// for @typescript-eslint/parser, wherever it's used
tsconfigRootDir: __dirname,
},
// this should be synced with the version of V8 used by the min supported node version
env: { es2020: true, node: true },
Expand Down Expand Up @@ -53,8 +56,39 @@ module.exports = {
},
},
overrides: [
/**
* All `.ts` files should be checked via `@typescript-eslint/parser`
*/
{
files: ['packages/**/*.ts'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended-type-checked'],
parserOptions: {
project: ['./packages/*/tsconfig.json'],
},
rules: {
'n/no-missing-import': 'off',
},
},
/**
*
*/
{
files: ['packages/allow-scripts/src/**/*.js'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended'],
parserOptions: {
project: ['./packages/allow-scripts/tsconfig.json'],
},
},
{
files: ['packages/*/src/**/*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['packages/*/test/**/*.js', 'packages/*/src/**/*.test.js'],
files: ['packages/*/test/**/*.js', 'packages/*/src/**/*.spec.js'],
extends: ['plugin:ava/recommended'],
rules: {
'ava/no-import-test-files': 'off',
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,30 @@ jobs:
with:
useRollingCache: true
install-command: npm ci --foreground-scripts
- name: Lint
run: npm run lint
- name: Test
run: npm test

lint:
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Upgrade npm # for workspace support
run: npm i -g npm@9 # npm@9 supports our supported Node.js versions
- name: Install Dependencies
uses: bahmutov/npm-install@1a235c31658a322a3b024444759650ee6345c26d # tag=v1
with:
useRollingCache: true
install-command: npm ci --foreground-scripts
- name: Lint
run: npm run lint
218 changes: 213 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"@tsconfig/node16": "^16.1.1",
"@types/node": "^20.5.9",
"@types/yargs": "^17.0.24",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"ava": "^5.3.1",
"conventional-changelog-conventionalcommits": "^6.1.0",
"depcheck": "^1.4.0",
Expand All @@ -25,6 +27,7 @@
"lint-staged": "^13.2.3",
"memfs": "^4.3.0",
"prettier": "^3.0.2",
"type-fest": "^2.19.0",
"typescript": "^5.2.2"
},
"engines": {
Expand Down
Loading