Skip to content

Commit

Permalink
Revert "update deps"
Browse files Browse the repository at this point in the history
This reverts commit 4bdc5fa.
  • Loading branch information
Luke-zhang-04 committed Apr 30, 2024
1 parent 4bdc5fa commit c9ab61b
Show file tree
Hide file tree
Showing 12 changed files with 1,486 additions and 1,766 deletions.
157 changes: 157 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
function* range(min, max) {
for (let num = min; num < max; num++) {
yield num
}
}

module.exports = {
env: {
es2021: true,
node: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/eslint-recommended"],
parser: "@typescript-eslint/parser",
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parserOptions: {
ecmaVersion: 2021,
sourceType: "module",
project: ["./tsconfig.json"],
},
plugins: ["@typescript-eslint", "prefer-arrow"],
rules: {
// General ESLint rules
"arrow-body-style": ["warn", "as-needed"],
"default-case-last": "warn",
"dot-location": ["warn", "property"],
eqeqeq: "error",
"id-length": ["error", {exceptions: ["_", "$"]}],
"max-len": "off",
"max-lines": ["warn", 500],
"max-statements": ["warn", {max: 25}],
"no-else-return": "warn",
"no-empty": ["warn", {allowEmptyCatch: true}],
"no-extra-semi": "off",
"no-negated-condition": "warn",
"no-nested-ternary": "warn",
"no-unused-vars": "off",
"no-var": "warn",
"object-shorthand": "warn",
"one-var": ["warn", "never"],
"padding-line-between-statements": [
"warn",
{blankLine: "always", prev: "*", next: "return"},
{blankLine: "always", prev: ["const", "let", "var"], next: "*"},
{blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"]},
{blankLine: "always", prev: "function", next: "*"},
],
"prefer-const": "warn",
"prefer-destructuring": [
"error",
{
array: false,
object: true,
},
],
"prefer-exponentiation-operator": "warn",
"prefer-object-spread": "warn",
"prefer-template": "warn",
"require-await": "warn",
"require-unicode-regexp": "warn",
"sort-imports": ["warn"],

// Typescript Rules
"@typescript-eslint/array-type": "warn",
"@typescript-eslint/consistent-indexed-object-style": ["warn", "index-signature"],
"@typescript-eslint/consistent-type-assertions": ["warn", {assertionStyle: "as"}],
"@typescript-eslint/member-ordering": "warn",
"@typescript-eslint/naming-convention": [
"error",
{
selector: "default",
format: ["camelCase"],
},
{
selector: "variableLike",
format: ["camelCase"],
leadingUnderscore: "allow",
},
{
selector: "memberLike",
modifiers: ["private"],
format: ["camelCase"],
leadingUnderscore: "require",
},
{
selector: "property",
modifiers: ["private"],
format: ["camelCase"],
leadingUnderscore: "require",
},
{
selector: "typeLike",
format: ["PascalCase"],
},
{
selector: "variable",
types: ["boolean"],
format: ["PascalCase"],
prefix: ["is", "should", "has", "can", "did", "will"],
},
{
selector: "parameter",
format: ["camelCase"],
leadingUnderscore: "allow",
},
{
selector: "property",
format: ["camelCase", "PascalCase", "snake_case", "UPPER_CASE"],
},
{
selector: "enumMember",
format: ["camelCase", "PascalCase", "snake_case", "UPPER_CASE"],
},
],
"@typescript-eslint/no-magic-numbers": [
"warn",
{
ignoreEnums: true,
ignoreNumericLiteralTypes: true,
ignoreReadonlyClassProperties: true,
ignoreArrayIndexes: true,
ignore: [...Array.from(range(-10, 11)), 16, 32, 64, 128, 256, 512],
},
],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",

// Typescript extension rules
"@typescript-eslint/default-param-last": "warn",
"@typescript-eslint/dot-notation": "warn",
"@typescript-eslint/lines-between-class-members": ["warn", "always"],
"@typescript-eslint/no-dupe-class-members": "warn",
"@typescript-eslint/no-duplicate-imports": "warn",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-shadow": "warn",
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-vars-experimental": "warn",
"@typescript-eslint/no-use-before-define": "warn",

// Preter arrow rules
"prefer-arrow-callback": "warn",
"prefer-arrow/prefer-arrow-functions": [
"warn",
{
disallowPrototype: true,
singleReturnOnly: false,
classPropertiesAllowed: true,
allowStandaloneDeclarations: false,
},
],
},
}
4 changes: 2 additions & 2 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jsdocSingleLineComment: false
tsdoc: true

plugins:
- prettier-plugin-jsdoc
- prettier-plugin-package
- ./node_modules/prettier-plugin-jsdoc
- ./node_modules/prettier-plugin-package

overrides:
- files:
Expand Down
63 changes: 63 additions & 0 deletions __tests__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import {escapeExecutablePath} from "../src/utils/escapePath"

describe("test path escape", () => {
it("should escape Windows path with space", () => {
const originalPath = "C:\\Program Files\\processing\\processing-java"

expect(escapeExecutablePath(originalPath)).toBe(
"C:\\Program` Files\\processing\\processing-java",
)
})

it("should escape Unix path with space", () => {
const originalPath = "/usr/bin/something else/processing-java"

expect(escapeExecutablePath(originalPath)).toBe(
"/usr/bin/something\\ else/processing-java",
)
})

it("should leave Windows path without spaces as is", () => {
const originalPath = ".\\processing\\processing-java"

expect(escapeExecutablePath(originalPath)).toBe(".\\processing\\processing-java")
})

it("should leave Unix path without spaces as is", () => {
const originalPath = "/usr/bin/processing-java"

expect(escapeExecutablePath(originalPath)).toBe("/usr/bin/processing-java")
})

it("should not escape already escaped spaces on Windows", () => {
const originalPath = "C:\\Program` Files\\processing\\processing java"

expect(escapeExecutablePath(originalPath)).toBe(
"C:\\Program` Files\\processing\\processing` java",
)
})

it("should not escape already escaped spaces on Unix", () => {
const originalPath = "/usr/bin/something else/processing\\ java"

expect(escapeExecutablePath(originalPath)).toBe(
"/usr/bin/something\\ else/processing\\ java",
)
})

it("should detect platform if no path seperators available", () => {
const originalPath = "processing java"

if (process.platform === "win32") {
expect(escapeExecutablePath(originalPath)).toBe("processing` java")
} else {
expect(escapeExecutablePath(originalPath)).toBe("processing\\ java")
}
})

it("should leave single path as is", () => {
const originalPath = "processing-java"

expect(escapeExecutablePath(originalPath)).toBe("processing-java")
})
})
3 changes: 3 additions & 0 deletions __tests__/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @type {import("ts-jest/dist/types").InitialOptionsTsJest}
*/
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
}
53 changes: 26 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
"type": "git",
"url": "https://github.com/Luke-zhang-04/processing-vscode.git"
},
"type": "module",
"homepage": "https://github.com/Luke-zhang-04/processing-vscode",
"bugs": "https://github.com/Luke-zhang-04/processing-vscode/issues",
"main": "./processing-vscode.js",
"engines": {
"vscode": "^1.78.0"
"vscode": "^1.48.0"
},
"scripts": {
"build": "rollup -c rollup.config.js",
"deploy": "vsce publish",
"format": "prettier . --write && eslint --ext ts --fix --cache",
"lint": "eslint --ext ts src --max-warnings 0 --cache",
"test": "jest --config ./jest.config.mjs",
"test": "node --experimental-vm-modules --experimental-specifier-resolution=node node_modules/.bin/jest",
"vscode:prepublish": "rollup -c rollup.config.js"
},
"keywords": [
Expand All @@ -33,32 +32,32 @@
"runner"
],
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.12",
"@types/jsdom": "^21.1.6",
"@types/node": "^20",
"@types/node-fetch": "^2.6.11",
"@types/vscode": "~1.78.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-typescript": "^8.2.1",
"@types/glob": "^7.1.4",
"@types/jest": "^27.0.3",
"@types/jsdom": "^16.2.13",
"@types/node": "^16.3.1",
"@types/node-fetch": "^2.5.11",
"@types/vscode": "^1.48.0",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"eslint": "^7.30.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"glob": "^10.3.12",
"jest": "^29.7.0",
"jsdom": "^24.0.0",
"node-fetch": "^3.3.2",
"prettier": "^3.2.5",
"prettier-plugin-jsdoc": "^1.3.0",
"prettier-plugin-package": "^1.4.0",
"rollup": "^4.17.1",
"glob": "^7.1.7",
"jest": "^27.4.5",
"jsdom": "^16.6.0",
"node-fetch": "^2.6.1",
"prettier": "^2.3.2",
"prettier-plugin-jsdoc": "^0.3.23",
"prettier-plugin-package": "^1.3.0",
"rollup": "^2.53.0",
"rollup-plugin-progress": "^1.1.2",
"ts-jest": "^29.1.2",
"tslib": "^2.6.2",
"typescript": "~5.4.5",
"vsce": "^2.15.0",
"yaml": "^2.4.2"
"ts-jest": "^27.1.2",
"tslib": "^2.3.0",
"typescript": "~4.3.5",
"vsce": "^1.95.1",
"yaml": "^1.10.2"
},
"activationEvents": [
"onCommand:processing.OpenExtensionDocumentation",
Expand Down
Loading

0 comments on commit c9ab61b

Please sign in to comment.