Skip to content

Commit

Permalink
Migrate to Yarn v4 and PnP from v1.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Aug 17, 2023
1 parent f3cdcff commit a91fc53
Show file tree
Hide file tree
Showing 19 changed files with 8,027 additions and 4,880 deletions.
12 changes: 0 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
// well....
if (require('eslint-config-standard-with-typescript/package.json').version === '37.0.0') {
console.log('Patching eslint-config-standard-with-typescript for TypeScript ESLint 6 support.')
const fs = require('fs')
const path = require('path')
const target = path.join(__dirname, 'node_modules', 'eslint-config-standard-with-typescript', 'lib', 'index.js')
const contents = fs.readFileSync(target, { encoding: 'utf8' }).split('\n')
.filter(line => !line.includes('restrict-plus-operands'))
.join('\n')
fs.writeFileSync(target, contents, { encoding: 'utf8' })
}

module.exports = {
env: {
es6: true,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile
run: corepack enable && yarn install --immutable

- name: Create mock config.json
run: echo '{"ip":"http://localhost:42069"}' > config.json
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
yarn lint
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint"
]
}
60 changes: 33 additions & 27 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],
"eslint.options": {
"extensions": [
".js",
".ts",
".jsx",
".tsx"
]
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
"eslint.enable": true,
"tslint.enable": false,
"eslint.packageManager": "yarn",
"eslint.autoFixOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
{
"language": "typescriptreact",
"autoFix": true
}
}
],
"eslint.options": {
"extensions": [
".js",
".ts",
".jsx",
".tsx"
]
},
"eslint.enable": true,
"tslint.enable": false,
"eslint.packageManager": "yarn",
"eslint.autoFixOnSave": true,
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"typescript.enablePromptUseWorkspaceTsdk": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/lib/index.js b/lib/index.js
index fd366a1673bf7480bad2e393df36d30799c64182..b56b6997093581a6314464e5f195eb8f0df291ff 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -204,7 +204,7 @@ const config = {
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': ['error', { ignoreStringArrays: true }],
- '@typescript-eslint/restrict-plus-operands': ['error', { checkCompoundAssignments: true }],
+ '@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
'@typescript-eslint/return-await': ['error', 'always'],
'@typescript-eslint/strict-boolean-expressions': ['error', {
diff --git a/package.json b/package.json
index 320e14445a74efb3328676caacecf6940ebc65cb..0203715407bb91b7fe7f519ee41014899b8d8f75 100644
--- a/package.json
+++ b/package.json
@@ -53,11 +53,11 @@
"TypeScript"
],
"dependencies": {
- "@typescript-eslint/parser": "^5.52.0",
+ "@typescript-eslint/parser": "^6.2.0",
"eslint-config-standard": "17.1.0"
},
"peerDependencies": {
- "@typescript-eslint/eslint-plugin": "^5.52.0",
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
"eslint": "^8.0.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
@@ -76,9 +76,9 @@
"@types/npm-package-arg": "6.1.1",
"@types/semver": "7.5.0",
"@types/ungap__structured-clone": "0.3.0",
- "@typescript-eslint_bottom/eslint-plugin": "npm:@typescript-eslint/[email protected]",
- "@typescript-eslint_bottom/parser": "npm:@typescript-eslint/[email protected]",
- "@typescript-eslint/eslint-plugin": "5.62.0",
+ "@typescript-eslint_bottom/eslint-plugin": "npm:@typescript-eslint/[email protected]",
+ "@typescript-eslint_bottom/parser": "npm:@typescript-eslint/[email protected]",
+ "@typescript-eslint/eslint-plugin": "6.2.0",
"@ungap/structured-clone": "1.2.0",
"ava": "5.3.1",
"editorconfig-checker": "5.1.1",
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);
6 changes: 6 additions & 0 deletions .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "eslint",
"version": "8.45.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
}
5 changes: 5 additions & 0 deletions .yarn/sdks/integrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost!

integrations:
- vscode
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/bin/tsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/bin/tsc your application uses
module.exports = absRequire(`typescript/bin/tsc`);
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/bin/tsserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/bin/tsserver your application uses
module.exports = absRequire(`typescript/bin/tsserver`);
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/lib/tsc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsc.js
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/lib/tsc.js your application uses
module.exports = absRequire(`typescript/lib/tsc.js`);
Loading

0 comments on commit a91fc53

Please sign in to comment.