Skip to content

Commit 6f16b55

Browse files
committed
style: apply lint
1 parent f82aa93 commit 6f16b55

13 files changed

+316
-84
lines changed

.eslintrc.cjs

+9-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
browser: false,
1111
node: true
1212
},
13-
plugins: ['import'],
13+
plugins: ['import', 'unicorn'],
1414
extends: [
1515
'standard-with-typescript',
1616
'plugin:import/recommended',
@@ -44,7 +44,14 @@ module.exports = {
4444
],
4545
'@typescript-eslint/restrict-template-expressions': 'off',
4646
'@typescript-eslint/no-unsafe-argument': 'off',
47-
'@typescript-eslint/unbound-method': 'off'
47+
'@typescript-eslint/unbound-method': 'off',
48+
'unicorn/prefer-node-protocol': 'error',
49+
'unicorn/catch-error-name': [
50+
'error',
51+
{
52+
name: 'err'
53+
}
54+
]
4855
},
4956
settings: {
5057
'import/parsers': {

.github/workflows/release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Release
22

33
on:
4+
push:
5+
branches:
6+
- master
47
schedule:
58
- cron: "*/30 * * * *"
69

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@
643643
"eslint-plugin-n": "^16.6.2",
644644
"eslint-plugin-prettier": "^5.1.3",
645645
"eslint-plugin-promise": "^6.1.1",
646+
"eslint-plugin-unicorn": "^53.0.0",
646647
"fast-glob": "^3.3.2",
647648
"md5": "^2.3.0",
648649
"mocha": "^10.3.0",

pnpm-lock.yaml

+253-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/copy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import path from 'path';
2-
import fs from 'fs/promises';
1+
import path from 'node:path';
2+
import fs from 'node:fs/promises';
33
import phpfmt from 'phpfmt';
44

55
void (async () => {

scripts/docs.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import path from 'path';
2-
import os from 'os';
3-
import fs from 'fs/promises';
1+
import path from 'node:path';
2+
import os from 'node:os';
3+
import fs from 'node:fs/promises';
44
import phpfmt from 'phpfmt';
55
import { Transformation } from '../src/Transformation';
66

scripts/release.ts

+34-36
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable n/no-sync */
22
/* eslint no-console: error */
3-
import path from 'path';
4-
import os from 'os';
5-
import { execSync } from 'child_process';
6-
import fs from 'fs/promises';
3+
import path from 'node:path';
4+
import os from 'node:os';
5+
import { execSync } from 'node:child_process';
6+
import fs from 'node:fs/promises';
77
import phpfmt from 'phpfmt';
88
import AdmZip from 'adm-zip';
99
import md5 from 'md5';
@@ -20,38 +20,6 @@ const changelogPath = path.join(__dirname, '../CHANGELOG.md');
2020

2121
void (async () => {
2222
try {
23-
// Publish to NPM
24-
try {
25-
execSync('npm publish --ignore-scripts', {
26-
stdio: 'inherit',
27-
env: {
28-
NODE_AUTH_TOKEN: process.env.NODE_AUTH_TOKEN
29-
}
30-
});
31-
} catch (err) {
32-
consola.error(err);
33-
}
34-
35-
// Publish to VSCE
36-
try {
37-
execSync(`vsce publish -p ${process.env.VSCE_TOKEN} --no-dependencies`, {
38-
stdio: 'inherit'
39-
});
40-
} catch (err) {
41-
consola.error(err);
42-
}
43-
44-
// Publish to OVSX
45-
try {
46-
execSync(`ovsx publish -p ${process.env.OVSX_TOKEN} --no-dependencies`, {
47-
stdio: 'inherit'
48-
});
49-
} catch (err) {
50-
consola.error(err);
51-
}
52-
53-
process.exit(1);
54-
5523
const pkg = JSON.parse(String(await fs.readFile(pkgJsonPath)));
5624
const currentVersion = pkg.version;
5725

@@ -145,6 +113,36 @@ ${changelogData}`;
145113
.addTag(`v${newVersion}`)
146114
.push()
147115
.pushTags();
116+
117+
// Publish to NPM
118+
try {
119+
execSync('npm publish --ignore-scripts', {
120+
stdio: 'inherit',
121+
env: {
122+
NODE_AUTH_TOKEN: process.env.NODE_AUTH_TOKEN
123+
}
124+
});
125+
} catch (err) {
126+
consola.error(err);
127+
}
128+
129+
// Publish to VSCE
130+
try {
131+
execSync(`vsce publish -p ${process.env.VSCE_TOKEN} --no-dependencies`, {
132+
stdio: 'inherit'
133+
});
134+
} catch (err) {
135+
consola.error(err);
136+
}
137+
138+
// Publish to OVSX
139+
try {
140+
execSync(`ovsx publish -p ${process.env.OVSX_TOKEN} --no-dependencies`, {
141+
stdio: 'inherit'
142+
});
143+
} catch (err) {
144+
consola.error(err);
145+
}
148146
} catch (err) {
149147
consola.error(err);
150148
process.exit(1);

src/PHPFmt.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { workspace as Workspace, window as Window } from 'vscode';
2-
import path from 'path';
3-
import fs from 'fs/promises';
4-
import os from 'os';
2+
import path from 'node:path';
3+
import fs from 'node:fs/promises';
4+
import os from 'node:os';
55
import detectIndent from 'detect-indent';
66
import findUp from 'find-up';
77
import { compare } from 'compare-versions';

src/Transformation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os from 'os';
1+
import os from 'node:os';
22
import mem from 'mem';
33
import phpfmt, { type PHPFmt as IPHPFmt } from 'phpfmt';
44
import { exec } from './utils';

src/utils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import childProcess, { type ExecOptions } from 'child_process';
2-
import fs, { type ObjectEncodingOptions } from 'fs';
3-
import https from 'https';
1+
import childProcess, { type ExecOptions } from 'node:child_process';
2+
import fs, { type ObjectEncodingOptions } from 'node:fs';
3+
import https from 'node:https';
44

55
export async function exec(
66
command: string,

test/runTest.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import path from 'path';
2-
import assert from 'assert';
1+
import path from 'node:path';
2+
import assert from 'node:assert';
33
import { runTests } from '@vscode/test-electron';
44
import findUp from 'find-up';
55

test/suite/extension.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import assert from 'assert';
1+
import assert from 'node:assert';
22
import fg from 'fast-glob';
33
import {
44
workspace as Workspace,

test/suite/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable n/no-sync */
2-
import * as path from 'path';
2+
import * as path from 'node:path';
33
import Mocha from 'mocha';
44
import { sync as globSync } from 'fast-glob';
55

0 commit comments

Comments
 (0)