Skip to content

Commit

Permalink
style: apply lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed Jun 8, 2024
1 parent f82aa93 commit 6f16b55
Show file tree
Hide file tree
Showing 13 changed files with 316 additions and 84 deletions.
11 changes: 9 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
browser: false,
node: true
},
plugins: ['import'],
plugins: ['import', 'unicorn'],
extends: [
'standard-with-typescript',
'plugin:import/recommended',
Expand Down Expand Up @@ -44,7 +44,14 @@ module.exports = {
],
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/unbound-method': 'off'
'@typescript-eslint/unbound-method': 'off',
'unicorn/prefer-node-protocol': 'error',
'unicorn/catch-error-name': [
'error',
{
name: 'err'
}
]
},
settings: {
'import/parsers': {
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Release

on:
push:
branches:
- master
schedule:
- cron: "*/30 * * * *"

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-unicorn": "^53.0.0",
"fast-glob": "^3.3.2",
"md5": "^2.3.0",
"mocha": "^10.3.0",
Expand Down
283 changes: 253 additions & 30 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions scripts/copy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import fs from 'fs/promises';
import path from 'node:path';
import fs from 'node:fs/promises';
import phpfmt from 'phpfmt';

void (async () => {
Expand Down
6 changes: 3 additions & 3 deletions scripts/docs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import os from 'os';
import fs from 'fs/promises';
import path from 'node:path';
import os from 'node:os';
import fs from 'node:fs/promises';
import phpfmt from 'phpfmt';
import { Transformation } from '../src/Transformation';

Expand Down
70 changes: 34 additions & 36 deletions scripts/release.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable n/no-sync */
/* eslint no-console: error */
import path from 'path';
import os from 'os';
import { execSync } from 'child_process';
import fs from 'fs/promises';
import path from 'node:path';
import os from 'node:os';
import { execSync } from 'node:child_process';
import fs from 'node:fs/promises';
import phpfmt from 'phpfmt';
import AdmZip from 'adm-zip';
import md5 from 'md5';
Expand All @@ -20,38 +20,6 @@ const changelogPath = path.join(__dirname, '../CHANGELOG.md');

void (async () => {
try {
// Publish to NPM
try {
execSync('npm publish --ignore-scripts', {
stdio: 'inherit',
env: {
NODE_AUTH_TOKEN: process.env.NODE_AUTH_TOKEN
}
});
} catch (err) {
consola.error(err);
}

// Publish to VSCE
try {
execSync(`vsce publish -p ${process.env.VSCE_TOKEN} --no-dependencies`, {
stdio: 'inherit'
});
} catch (err) {
consola.error(err);
}

// Publish to OVSX
try {
execSync(`ovsx publish -p ${process.env.OVSX_TOKEN} --no-dependencies`, {
stdio: 'inherit'
});
} catch (err) {
consola.error(err);
}

process.exit(1);

const pkg = JSON.parse(String(await fs.readFile(pkgJsonPath)));
const currentVersion = pkg.version;

Expand Down Expand Up @@ -145,6 +113,36 @@ ${changelogData}`;
.addTag(`v${newVersion}`)
.push()
.pushTags();

// Publish to NPM
try {
execSync('npm publish --ignore-scripts', {
stdio: 'inherit',
env: {
NODE_AUTH_TOKEN: process.env.NODE_AUTH_TOKEN
}
});
} catch (err) {
consola.error(err);
}

// Publish to VSCE
try {
execSync(`vsce publish -p ${process.env.VSCE_TOKEN} --no-dependencies`, {
stdio: 'inherit'
});
} catch (err) {
consola.error(err);
}

// Publish to OVSX
try {
execSync(`ovsx publish -p ${process.env.OVSX_TOKEN} --no-dependencies`, {
stdio: 'inherit'
});
} catch (err) {
consola.error(err);
}
} catch (err) {
consola.error(err);
process.exit(1);
Expand Down
6 changes: 3 additions & 3 deletions src/PHPFmt.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { workspace as Workspace, window as Window } from 'vscode';
import path from 'path';
import fs from 'fs/promises';
import os from 'os';
import path from 'node:path';
import fs from 'node:fs/promises';
import os from 'node:os';
import detectIndent from 'detect-indent';
import findUp from 'find-up';
import { compare } from 'compare-versions';
Expand Down
2 changes: 1 addition & 1 deletion src/Transformation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import mem from 'mem';
import phpfmt, { type PHPFmt as IPHPFmt } from 'phpfmt';
import { exec } from './utils';
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import childProcess, { type ExecOptions } from 'child_process';
import fs, { type ObjectEncodingOptions } from 'fs';
import https from 'https';
import childProcess, { type ExecOptions } from 'node:child_process';
import fs, { type ObjectEncodingOptions } from 'node:fs';
import https from 'node:https';

export async function exec(
command: string,
Expand Down
4 changes: 2 additions & 2 deletions test/runTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import assert from 'assert';
import path from 'node:path';
import assert from 'node:assert';
import { runTests } from '@vscode/test-electron';
import findUp from 'find-up';

Expand Down
2 changes: 1 addition & 1 deletion test/suite/extension.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import assert from 'assert';
import assert from 'node:assert';
import fg from 'fast-glob';
import {
workspace as Workspace,
Expand Down
2 changes: 1 addition & 1 deletion test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable n/no-sync */
import * as path from 'path';
import * as path from 'node:path';
import Mocha from 'mocha';
import { sync as globSync } from 'fast-glob';

Expand Down

0 comments on commit 6f16b55

Please sign in to comment.