diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3ea5f52 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf + +[*.{ts,js}] +indent_style = tab +indent_size = 4 + +[*.json] +indent_style = space +indent_size = 2 +insert_final_newline = true \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..52323c4 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +.history +lib +node_modules +package-lock.json \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..95fe455 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,14 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "plugins": ["prettier"], + "env": { + "node": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d63c3e5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,15 @@ + +name: CI + +on: [push] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12 + - run: npm install \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..4f1db67 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,16 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + - run: npm install + - run: npm run publish -- -p $VSCODE_MARKETPLACE_TOKEN + env: + VSCODE_MARKETPLACE_TOKEN: ${{secrets.VSCODE_MARKETPLACE_TOKEN}} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..acda8a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.history +lib +node_modules \ No newline at end of file diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 0000000..2105dfa --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1 @@ +semi: false \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..70c35f6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Run Extension", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ], + "outFiles": [ + "${workspaceFolder}/lib/**/*.js" + ] + } + ] +} diff --git a/.vscodeignore b/.vscodeignore new file mode 100644 index 0000000..89867e3 --- /dev/null +++ b/.vscodeignore @@ -0,0 +1,5 @@ +** +!assets +!lib/*.js +!README.md +!LICENSE \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8c1720d --- /dev/null +++ b/package.json @@ -0,0 +1,102 @@ +{ + "name": "phpstan", + "displayName": "PHPStan", + "description": "PHPStan for VSCode", + "version": "1.0.0", + "license": "MIT", + "publisher": "swordev", + "author": "Juanra Gálvez ", + "icon": "assets/logo.png", + "engines": { + "vscode": "^1.50.0" + }, + "categories": [ + "Linters", + "Programming Languages" + ], + "keywords": [ + "php", + "phpstan", + "linter", + "problems", + "errors", + "analyse" + ], + "activationEvents": [ + "workspaceContains:**/phpstan.neon", + "workspaceContains:**/phpstan.neon.dist" + ], + "repository": { + "type": "git", + "url": "https://github.com/swordev/phpstan-vscode.git" + }, + "bugs": { + "url": "https://github.com/swordev/phpstan-vscode/issues" + }, + "main": "./lib/extension.js", + "contributes": { + "configuration": { + "type": "object", + "title": "PHPStan", + "properties": { + "phpstan.enabled": { + "type": "boolean", + "description": "Enables PHPStan", + "default": true + }, + "phpstan.path": { + "type": "string", + "description": "PHPStan binary path", + "default": "./vendor/phpstan/phpstan/phpstan" + }, + "phpstan.phpPath": { + "type": "string", + "description": "PHP binary path", + "default": "php" + }, + "phpstan.memoryLimit": { + "type": "string", + "description": "PHP memory limit", + "default": "-1" + }, + "phpstan.fileWatcher": { + "type": "boolean", + "description": "Enables file watcher", + "default": true + }, + "phpstan.fileWatcherPattern": { + "type": "string", + "description": "File watcher glob pattern", + "default": "**/*.{php}" + }, + "phpstan.analysedDelay": { + "type": "integer", + "description": "Milliseconds delay between file changes before run analyse", + "default": 200 + } + } + } + }, + "scripts": { + "publish": "vsce publish", + "vscode:prepublish": "npm run prepare", + "build": "rimraf lib/* && tsc -p ./src/tsconfig.json", + "dev": "tsc -p ./src/tsconfig.json -w", + "lint": "eslint . --ext .ts,.js,.json", + "lint:fix": "eslint . --ext .ts,.js,.json --fix", + "prepare": "npm run build && npm run lint" + }, + "devDependencies": { + "@types/node": "^14.14.6", + "@types/vscode": "^1.50.0", + "@typescript-eslint/eslint-plugin": "^4.6.0", + "@typescript-eslint/parser": "^4.6.0", + "eslint": "^7.12.1", + "eslint-config-prettier": "^6.15.0", + "eslint-plugin-prettier": "^3.1.4", + "prettier": "2.1.2", + "rimraf": "^3.0.2", + "typescript": "^4.0.5", + "vsce": "^1.81.1" + } +} diff --git a/src/tsconfig.json b/src/tsconfig.json new file mode 100644 index 0000000..0632067 --- /dev/null +++ b/src/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "composite": true + }, + "include": ["./*.ts"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..8923a7e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "module": "CommonJS", + "target": "ES6", + "outDir": "lib" + } +}