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

📦 Chore: migrate to standardjs #83

Merged
merged 5 commits into from
Apr 26, 2021
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
root: true,
extends: ['standard-with-typescript', 'prettier-standard'],
parserOptions: {
project: './tsconfig.json'
},
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: true
}
}
],
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/strict-boolean-expressions': 0,
'no-console': 'warn'
},
overrides: [
{
files: ['./*.js', './*.ts'],
rules: {
'import/no-anonymous-default-export': 0,
'filenames/match-exported': 0
}
}
]
}
19 changes: 0 additions & 19 deletions .eslintrc.json

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ package-lock.json
coverage
.coveralls.yml
.DS_Store
dist
dist
tmp
assets/test.md
7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

11 changes: 10 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker",
"davidanson.vscode-markdownlint",
"yzhang.markdown-all-in-one",
"wix.vscode-import-cost",
"pkief.material-icon-theme",
"eamodio.gitlens"
]
}
10 changes: 7 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--user-data-dir=tmp",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test/runner/index"
"--extensionTestsPath=${workspaceFolder}/out/test/runner/index"
],
"outFiles": ["${workspaceFolder}/dist/test/**/*.js"]
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "npm: test-compile"
}
]
}
34 changes: 33 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,37 @@
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
"typescript.tsc.autoDetect": "off",
"files.insertFinalNewline": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
// Use eslint to format js/ts files
// prettier is included by eslint
"[javascript]": {
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": false
},
"[typescriptreact]": {
"editor.formatOnSave": false
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.packageManager": "yarn",
"typescript.tsdk": "node_modules\\typescript\\lib",
"editor.tabSize": 2,
"cSpell.words": [
"Mixins",
"picgo",
"vspicgo"
]
}
58 changes: 40 additions & 18 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that calls a custom npm script that compiles the extension.
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
"version": "2.0.0",
"presentation": {
"echo": false,
"reveal": "always",
"focus": false,
"panel": "dedicated",
"showReuseMessage": false
},
"tasks": [
{
"type": "npm",
"script": "build",
"group": "build",
"problemMatcher": ["$ts-checker-webpack", "$ts-checker-eslint-webpack"]
},
{
"type": "npm",
"script": "lint",
"group": "build",
"problemMatcher": ["$eslint-stylish"]
},
{
"type": "npm",
"script": "watch",
"group": {
"kind": "build",
"isDefault": true
},
"isBackground": true,
"problemMatcher": ["$ts-checker-webpack-watch", "$ts-checker-eslint-webpack-watch"]
}
]
}
3 changes: 2 additions & 1 deletion .yarnrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
--upgrade.registry "https://registry.npm.taobao.org"
--install.ignore-engines true
--install.registry "https://registry.npm.taobao.org"
--remove.ignore-engines true
--remove.ignore-engines true
ignore-engines true
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

[![version](https://img.shields.io/vscode-marketplace/v/Spades.vs-picgo.svg?style=flat-square&label=vscode%20marketplace)](https://marketplace.visualstudio.com/items?itemName=Spades.vs-picgo)
[![installs](https://img.shields.io/vscode-marketplace/d/Spades.vs-picgo.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=Spades.vs-picgo)
[![Build](https://github.com/PicGo/vs-picgo/workflows/Build/badge.svg?sanitize=true)](https://github.com/PicGo/vs-picgo/actions?query=workflow%3A%22Build%22)
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FPicGo%2Fvs-picgo%2Fbadge%3Fref%3Ddev&style=flat-square)](https://actions-badge.atrox.dev/PicGo/vs-picgo/goto?ref=dev)
[![Coveralls github branch](https://img.shields.io/coveralls/github/PicGo/vs-picgo/refs/heads/dev.svg?style=flat-square)](https://coveralls.io/github/PicGo/vs-picgo?branch=refs/heads/dev)
[![GitHub stars](https://img.shields.io/github/stars/PicGo/vs-picgo.svg?style=flat-square&label=github%20stars)](https://github.com/PicGo/vs-picgo)
[![PicGo Convention](https://img.shields.io/badge/picgo-convention-blue.svg?style=flat-square)](https://github.com/PicGo/bump-version)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com)

## Overview

Expand Down Expand Up @@ -49,7 +50,7 @@

- Default
- The default image hosting is [SM.MS](https://sm.ms/).

- Custom

<details>
Expand Down
45 changes: 29 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"version": "2.1.0",
"publisher": "Spades",
"engines": {
"vscode": "^1.43.0"
"vscode": "^1.55.0"
},
"categories": [
"Other"
Expand Down Expand Up @@ -294,20 +294,24 @@
"vscode:prepublish": "webpack --mode production",
"compile": "webpack --mode development",
"watch": "webpack --mode development --watch",
"test-compile": "tsc -p ./",
"test": "tsc -p ./ && node ./out/test/run-test.js",
"lint": "eslint ./src --ext ts",
"codestyle:check": "prettier --check ./src/**/*.ts **/**.json",
"codestyle:fix": "prettier --write ./src/**/*.ts **/**.json",
"cz": "git-cz",
"test-compile": "tsc -p ./",
"lint": "eslint --fix --ext .js,.jsx,.ts,.tsx .",
"cz": "lint-staged && git-cz",
"release": "run bump-version"
},
"husky": {
"hooks": {
"pre-commit": "yarn codestyle:check && yarn lint",
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx,mjs,mjsx,cjs,cjsx}": [
"eslint --fix --color",
"git add"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-customizable"
Expand All @@ -323,29 +327,38 @@
},
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@picgo/bump-version": "^1.0.3",
"@picgo/bump-version": "https://github.com/PicGo/bump-version",
"@types/glob": "^7.1.1",
"@types/inquirer": "^6.5.0",
"@types/istanbul": "^0.4.30",
"@types/lodash": "4.14.168",
"@types/mocha": "^7.0.1",
"@types/node": "^12.11.7",
"@types/request-promise-native": "^1.0.17",
"@types/vscode": "^1.43.0",
"@typescript-eslint/eslint-plugin": "^2.18.0",
"@typescript-eslint/parser": "^2.18.0",
"@types/vscode": "1.55.0",
"@types/webpack-env": "1.16.0",
"@typescript-eslint/eslint-plugin": "4.1.0",
"clean-webpack-plugin": "3.0.0",
"copy-webpack-plugin": "7.0.0",
"copy-webpack-plugin": "8.1.1",
"cz-conventional-changelog": "^3.1.0",
"cz-customizable": "6.2.0",
"decache": "^4.5.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint": "7.24.0",
"eslint-config-prettier": "8.1.0",
"eslint-config-prettier-standard": "4.0.1",
"eslint-config-standard-with-typescript": "20.0.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "3.3.1",
"eslint-plugin-promise": "5.1.0",
"eslint-plugin-standard": "5.0.0",
"glob": "^7.1.6",
"husky": "^4.2.3",
"istanbul": "^0.4.5",
"lint-staged": "10.5.4",
"mocha": "^7.0.1",
"prettier": "^1.19.1",
"prettier": "2.2.1",
"prettier-config-standard": "4.0.0",
"remap-istanbul": "^0.13.0",
"ts-loader": "8.0.12",
"typescript": "^3.7.5",
Expand Down
4 changes: 2 additions & 2 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"config.customOutputFormat.description": "Customize the output format of the uploaded image.\n- `${url}`: the url of the uploaded image.\n- `${uploadedName}`: the name of the uploaded image without extension name, see `#picgo.customUploadName#`, note that even if you used `${extName}` in `#picgo.customUploadName#`, there still will be no extension name in the output.\n\nExamples:\n- `![${uploadedName}](${url})` -> `![picName-2016-07-25](https://example.com/xxx.jpg)`\n- `<img src=\"${url}\" alt=\"${uploadedName}\">` -> `<img src=\"https://example.com/xxx.jpg\" alt=\"picName-2016-07-25\">`",
"config.picBed.uploader": "Please see [`picBed.uploader`](https://picgo.github.io/PicGo-Core-Doc/zh/guide/config.html#picbed-uploader).",
"config.picBed.current": "Please see [`picBed.current`](https://picgo.github.io/PicGo-Core-Doc/zh/guide/config.html#picbed-current).",
"picgo.picBed.proxy": "Proxy for `request`, see [`picBed.proxy`](https://picgo.github.io/PicGo-Core-Doc/zh/guide/config.html#picbed-proxy) for more detail.",
"config.picBed.proxy": "Proxy for `request`, see [`picBed.proxy`](https://picgo.github.io/PicGo-Core-Doc/zh/guide/config.html#picbed-proxy) for more detail.",
"config.picBed.smms.description": "SM.MS picBed configuration.",
"config.picBed.weibo.description": "Weibo picBed configuration.",
"config.picBed.qiniu.description": "Qiniu picBed configuration.",
Expand All @@ -28,4 +28,4 @@
"config.picBed.github.repo.description": "`Username/Repo`. For example, PicGo/Images",
"config.picBed.aliyun.description": "Aliyun OSS configuration.",
"config.picBed.imgur.description": "Imgur picBed configuration."
}
}
Loading