├── .gitignore ├── .vscode └── launch.json ├── LICENSE ├── README.md ├── jscs-server ├── .vscode │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── package.json └── src │ ├── server.ts │ ├── tsconfig.json │ └── typings │ ├── node │ └── node.d.ts │ └── promise.d.ts ├── jscs ├── .vscode │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── .vscodeignore ├── JSCS_icon.png ├── JSCS_icon.svg ├── LICENSE.md ├── README.md ├── extension.ts ├── package.json ├── server │ ├── package.json │ ├── server.js │ └── server.js.map ├── tsconfig.json └── typings │ └── vscode-typings.d.ts ├── test ├── .jscsrc ├── .vscode │ └── settings.json ├── debug.log ├── index.js ├── package.json ├── test.1.js ├── test.js └── test.jsx └── thirdpartynotices.txt /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | *.vsix -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [] 4 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 8 | files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, 9 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 16 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 17 | OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![alt text](http://vsmarketplacebadge.apphb.com/version/ms-vscode.jscs.svg "Marketplace") 2 | 3 | ![alt text](http://vsmarketplacebadge.apphb.com/installs/ms-vscode.jscs.svg "Installs") 4 | 5 | # JSCS Support for Visual Studio Code 6 | 7 | [JSCS](https://jscs-dev.github.io) support for Visual Studio Code. 8 | 9 | > **❗IMPORTANT**: JSCS [is deprecated and has merged with ESLint](https://medium.com/@markelog/jscs-end-of-the-line-bc9bf0b3fdb2). 10 | > 11 | > Please migrate your projects to ESLint and use the VS Code [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint). 12 | 13 | # Installation and Usage 14 | 15 | The JSCS Linter is available in the Visual Studio Code Gallery. To install, press `F1` and 16 | select `Extensions: Install Extensions` and then search for and select `JSCS Linting`. 17 | 18 | Install JSCS in your workspace (or globally using the `-g` switch). 19 | 20 | ``` bash 21 | # install locally to the workspace 22 | npm install jscs 23 | ``` 24 | 25 | Once installed, the JSCS Linter will automatically analyze your JavaScript files and return style warnings 26 | based on the rules you define in a `.jscsrc` file or in your settings. 27 | 28 | ## Configuring the JSCS Linter 29 | 30 | The best way to configure how the linter flags issues in your code is to create a `.jscsrc` file in the 31 | root of your workspace. The VS Code JSCS Linter will look for this file first and if no `.jscsrc` file is found 32 | it will look into your custom [Settings](https://code.visualstudio.com/docs/customization/userandworkspace). 33 | 34 | Here are the available settings options: 35 | 36 | Enable or disable the JSCS Linter for JavaScript files in this workspace. 37 | ``` json 38 | "jscs.enable": boolean 39 | ``` 40 | 41 | The JSCS preset to use, possible values: `airbnb`, `crockford`, `google`, `grunt`, `idiomatic`, `jquery`, `mdcs`, `node-style-guide`, `wikimedia`, `wordpress`, `yandex`. 42 | ``` json 43 | "jscs.preset": string 44 | ``` 45 | 46 | Disable the JSCS Linter if no `.jscsrc` configuration file is found, default is `false`. 47 | ``` json 48 | "jscs.disableIfNoConfig": boolean 49 | ``` 50 | 51 | Set [JSCS configuration rules](http://jscs.info/rules) in your settings file directly. 52 | ``` json 53 | "jscs.configuration": object 54 | ``` 55 | 56 | # Development 57 | The JSCS Linter is a great way to learn how to create extensions for VS Code. 58 | We also love enhancements and bug fixes! Here's how to get started: 59 | 60 | ``` bash 61 | git clone https://github.com/microsoft/vscode-jscs 62 | cd vscode-jscs/jscs 63 | npm install 64 | cd ../jscs-server 65 | npm install 66 | ``` 67 | ## Developing the Server 68 | - Open VS Code on the `jscs-server` folder 69 | - Run `npm run compile` or `npm run watch` to build the server and copy it into the `jscs` folder 70 | - To debug, press F5 *once the extension is loaded*, this will attach the debugger to the server. 71 | If you try to attach too soon you will get a timeout error from the debugger. 72 | 73 | ## Developing the Extension 74 | - Open VS Code on the `jscs` folder 75 | - To run, press `F5` to build the app, launch the extension environment, and attach a debugger 76 | 77 | Enjoy! 78 | 79 | # License 80 | [MIT](LICENSE) 81 | -------------------------------------------------------------------------------- /jscs-server/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | // List of configurations. Add new configurations or edit existing ones. 4 | "configurations": [ 5 | { 6 | "name": "Attach", 7 | "type": "node", 8 | "request": "attach", 9 | // TCP/IP address. Default is "localhost". 10 | "address": "localhost", 11 | // Port to attach to. 12 | "port": 6004, 13 | "sourceMaps": true, 14 | "outDir": "${workspaceRoot}/../jscs/server" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /jscs-server/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "javascript.validate.enable": false, 4 | "files.trimTrailingWhitespace": true, 5 | "editor.insertSpaces": false, 6 | "editor.tabSize": 4, 7 | "tslint.enable": false 8 | } -------------------------------------------------------------------------------- /jscs-server/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "command": "npm", 4 | "isShellCommand": true, 5 | "showOutput": "silent", 6 | "args": ["run", "watch"], 7 | "isWatching": true, 8 | "problemMatcher": "$tsc-watch" 9 | } -------------------------------------------------------------------------------- /jscs-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jscs-server", 3 | "version": "0.1.4", 4 | "description": "JSCS Server", 5 | "author": "Microsoft Corporation", 6 | "license": "MIT", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/Microsoft/vscode-jscs.git" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/Microsoft/vscode-jscs/issues" 13 | }, 14 | "engines": { 15 | "node": "*" 16 | }, 17 | "private": true, 18 | "dependencies": { 19 | "vscode-languageserver": "^2.0.0" 20 | }, 21 | "devDependencies": { 22 | "copyfiles": "^0.2.1", 23 | "typescript": "^1.8.10" 24 | }, 25 | "scripts": { 26 | "compile": "installServerIntoExtension ../jscs ./package.json ./src/tsconfig.json && tsc -p ./src", 27 | "watch": "installServerIntoExtension ../jscs ./package.json ./src/tsconfig.json && tsc --watch -p ./src" 28 | } 29 | } -------------------------------------------------------------------------------- /jscs-server/src/server.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | 'use strict'; 5 | 6 | import * as server from 'vscode-languageserver'; 7 | import fs = require('fs'); 8 | import path = require('path'); 9 | 10 | interface JSCSError { 11 | additional: any, 12 | column: number, 13 | filename: string, 14 | fixed: any, 15 | line: number, 16 | message: string, 17 | rule: string 18 | } 19 | 20 | interface Settings { 21 | jscs: { 22 | enable: boolean; 23 | preset: string; 24 | configuration: any; 25 | disableIfNoConfig: boolean; 26 | displaySeverity: server.DiagnosticSeverity; 27 | } 28 | } 29 | 30 | 31 | let configCache = { 32 | filePath: null, 33 | configuration: null 34 | } 35 | 36 | let settings: Settings = null; 37 | let options: {} = null; 38 | let linter: any = null; 39 | let configLib: any = null; 40 | let connection: server.IConnection = server.createConnection(process.stdin, process.stdout); 41 | let documents: server.TextDocuments = new server.TextDocuments(); 42 | 43 | function flushConfigCache() { 44 | configCache = { 45 | filePath: null, 46 | configuration: null 47 | } 48 | } 49 | 50 | function validateSingle(document: server.TextDocument): void { 51 | try { 52 | validate(document); 53 | } catch (err) { 54 | connection.window.showErrorMessage(getMessage(err, document)); 55 | } 56 | } 57 | 58 | function validateMany(documents: server.TextDocument[]): void { 59 | let tracker = new server.ErrorMessageTracker(); 60 | documents.forEach(document => { 61 | try { 62 | validate(document); 63 | } catch (err) { 64 | tracker.add(getMessage(err, document)); 65 | } 66 | }); 67 | tracker.sendErrors(connection); 68 | } 69 | 70 | function getConfiguration(filePath: string): any { 71 | 72 | if (configCache.configuration && configCache.filePath === filePath) { 73 | return configCache.configuration; 74 | } 75 | 76 | configCache = { 77 | filePath: filePath, 78 | configuration: configLib.load(false, filePath) 79 | } 80 | 81 | return configCache.configuration; 82 | } 83 | 84 | function validate(document: server.TextDocument): void { 85 | 86 | try { 87 | 88 | let checker = new linter(); 89 | let fileContents = document.getText(); 90 | let uri = document.uri; 91 | let fsPath = server.Files.uriToFilePath(uri); 92 | 93 | 94 | let config = getConfiguration(fsPath); 95 | 96 | if (!config && settings.jscs.disableIfNoConfig) { 97 | return; 98 | } 99 | 100 | if (settings.jscs.configuration) { 101 | options = settings.jscs.configuration; 102 | } else if (settings.jscs.preset) { 103 | options = { 104 | "preset": settings.jscs.preset 105 | }; 106 | } else { 107 | // TODO provide some sort of warning that there is no config 108 | // use jquery by default 109 | options = { "preset": "jquery" }; 110 | } 111 | 112 | // configure jscs module 113 | checker.registerDefaultRules(); 114 | checker.configure(config || options); 115 | 116 | let diagnostics: server.Diagnostic[] = []; 117 | let results = checker.checkString(fileContents); 118 | let errors: JSCSError[] = results.getErrorList(); 119 | 120 | // test for checker.maxErrorsExceeded(); 121 | 122 | if (errors.length > 0) { 123 | errors.forEach((e) => { 124 | diagnostics.push(makeDiagnostic(e)); 125 | }) 126 | } 127 | 128 | //return connection.sendDiagnostics({ uri, diagnostics }); 129 | connection.sendDiagnostics({ uri, diagnostics }); 130 | 131 | } catch (err) { 132 | let message: string = null; 133 | if (typeof err.message === 'string' || err.message instanceof String) { 134 | message = err.message; 135 | throw new Error(message); 136 | } 137 | throw err; 138 | } 139 | } 140 | 141 | function makeDiagnostic(e: JSCSError): server.Diagnostic { 142 | 143 | let res: server.Diagnostic; 144 | 145 | res = { 146 | message: e.message, 147 | // all JSCS errors are Warnings in our world 148 | severity: server.DiagnosticSeverity.Warning, 149 | // start alone will select word if in one 150 | range: { 151 | start: { 152 | line: e.line - 1, 153 | character: e.column 154 | }, 155 | end: { 156 | line: e.line - 1, 157 | character: Number.MAX_VALUE 158 | } 159 | }, 160 | code: e.rule, 161 | source: 'JSCS' 162 | }; 163 | return res; 164 | } 165 | 166 | function getMessage(err: any, document: server.TextDocument): string { 167 | let result: string = null; 168 | if (typeof err.message === 'string' || err.message instanceof String) { 169 | result = err.message; 170 | result = result.replace(/\r?\n/g, ' '); 171 | } else { 172 | result = `An unknown error occured while validating file: ${server.Files.uriToFilePath(document.uri)}`; 173 | } 174 | return result; 175 | } 176 | 177 | // The documents manager listen for text document create, change 178 | // and close on the connection 179 | documents.listen(connection); 180 | 181 | // A text document has changed. Validate the document. 182 | documents.onDidChangeContent((event) => { 183 | validateSingle(event.document); 184 | }); 185 | 186 | connection.onInitialize((params): Thenable> => { 187 | let rootPath = params.rootPath; 188 | 189 | return server.Files.resolveModule(rootPath, 'jscs').then((value) => { 190 | linter = value; 191 | return server.Files.resolveModule(rootPath, 'jscs/lib/cli-config').then((value) => { 192 | configLib = value; 193 | 194 | 195 | return { capabilities: { textDocumentSync: documents.syncKind } }; 196 | }, (error) => { 197 | return Promise.reject( 198 | new server.ResponseError(99, 199 | 'Failed to load jscs/lib/cli-config library. Please install jscs in your workspace folder using \'npm install jscs\' and then press Retry.', 200 | { retry: true })); 201 | }); 202 | }, (error) => { 203 | return Promise.reject( 204 | new server.ResponseError(99, 205 | 'Failed to load jscs library. Please install jscs in your workspace folder using \'npm install jscs\' and then press Retry.', 206 | { retry: true })); 207 | }); 208 | 209 | }) 210 | 211 | connection.onDidChangeConfiguration((params) => { 212 | flushConfigCache(); 213 | settings = params.settings; 214 | validateMany(documents.all()); 215 | }); 216 | 217 | connection.onDidChangeWatchedFiles((params) => { 218 | flushConfigCache(); 219 | validateMany(documents.all()); 220 | }); 221 | 222 | connection.listen(); 223 | -------------------------------------------------------------------------------- /jscs-server/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "outDir": "../../jscs/server" 8 | }, 9 | "exclude": [ 10 | "node_modules" 11 | ] 12 | } -------------------------------------------------------------------------------- /jscs-server/src/typings/node/node.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for Node.js v0.12.0 2 | // Project: http://nodejs.org/ 3 | // Definitions by: Microsoft TypeScript , DefinitelyTyped 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | /************************************************ 7 | * * 8 | * Node.js v0.12.0 API * 9 | * * 10 | ************************************************/ 11 | 12 | interface Error { 13 | stack?: string; 14 | } 15 | 16 | 17 | // compat for TypeScript 1.5.3 18 | // if you use with --target es3 or --target es5 and use below definitions, 19 | // use the lib.es6.d.ts that is bundled with TypeScript 1.5.3. 20 | interface MapConstructor {} 21 | interface WeakMapConstructor {} 22 | interface SetConstructor {} 23 | interface WeakSetConstructor {} 24 | 25 | /************************************************ 26 | * * 27 | * GLOBAL * 28 | * * 29 | ************************************************/ 30 | declare var process: NodeJS.Process; 31 | declare var global: NodeJS.Global; 32 | 33 | declare var __filename: string; 34 | declare var __dirname: string; 35 | 36 | declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; 37 | declare function clearTimeout(timeoutId: NodeJS.Timer): void; 38 | declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; 39 | declare function clearInterval(intervalId: NodeJS.Timer): void; 40 | declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; 41 | declare function clearImmediate(immediateId: any): void; 42 | 43 | interface NodeRequireFunction { 44 | (id: string): any; 45 | } 46 | 47 | interface NodeRequire extends NodeRequireFunction { 48 | resolve(id:string): string; 49 | cache: any; 50 | extensions: any; 51 | main: any; 52 | } 53 | 54 | declare var require: NodeRequire; 55 | 56 | interface NodeModule { 57 | exports: any; 58 | require: NodeRequireFunction; 59 | id: string; 60 | filename: string; 61 | loaded: boolean; 62 | parent: any; 63 | children: any[]; 64 | } 65 | 66 | declare var module: NodeModule; 67 | 68 | // Same as module.exports 69 | declare var exports: any; 70 | declare var SlowBuffer: { 71 | new (str: string, encoding?: string): Buffer; 72 | new (size: number): Buffer; 73 | new (size: Uint8Array): Buffer; 74 | new (array: any[]): Buffer; 75 | prototype: Buffer; 76 | isBuffer(obj: any): boolean; 77 | byteLength(string: string, encoding?: string): number; 78 | concat(list: Buffer[], totalLength?: number): Buffer; 79 | }; 80 | 81 | 82 | // Buffer class 83 | interface Buffer extends NodeBuffer {} 84 | 85 | /** 86 | * Raw data is stored in instances of the Buffer class. 87 | * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. 88 | * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' 89 | */ 90 | declare var Buffer: { 91 | /** 92 | * Allocates a new buffer containing the given {str}. 93 | * 94 | * @param str String to store in buffer. 95 | * @param encoding encoding to use, optional. Default is 'utf8' 96 | */ 97 | new (str: string, encoding?: string): Buffer; 98 | /** 99 | * Allocates a new buffer of {size} octets. 100 | * 101 | * @param size count of octets to allocate. 102 | */ 103 | new (size: number): Buffer; 104 | /** 105 | * Allocates a new buffer containing the given {array} of octets. 106 | * 107 | * @param array The octets to store. 108 | */ 109 | new (array: Uint8Array): Buffer; 110 | /** 111 | * Allocates a new buffer containing the given {array} of octets. 112 | * 113 | * @param array The octets to store. 114 | */ 115 | new (array: any[]): Buffer; 116 | prototype: Buffer; 117 | /** 118 | * Returns true if {obj} is a Buffer 119 | * 120 | * @param obj object to test. 121 | */ 122 | isBuffer(obj: any): boolean; 123 | /** 124 | * Returns true if {encoding} is a valid encoding argument. 125 | * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' 126 | * 127 | * @param encoding string to test. 128 | */ 129 | isEncoding(encoding: string): boolean; 130 | /** 131 | * Gives the actual byte length of a string. encoding defaults to 'utf8'. 132 | * This is not the same as String.prototype.length since that returns the number of characters in a string. 133 | * 134 | * @param string string to test. 135 | * @param encoding encoding used to evaluate (defaults to 'utf8') 136 | */ 137 | byteLength(string: string, encoding?: string): number; 138 | /** 139 | * Returns a buffer which is the result of concatenating all the buffers in the list together. 140 | * 141 | * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. 142 | * If the list has exactly one item, then the first item of the list is returned. 143 | * If the list has more than one item, then a new Buffer is created. 144 | * 145 | * @param list An array of Buffer objects to concatenate 146 | * @param totalLength Total length of the buffers when concatenated. 147 | * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. 148 | */ 149 | concat(list: Buffer[], totalLength?: number): Buffer; 150 | /** 151 | * The same as buf1.compare(buf2). 152 | */ 153 | compare(buf1: Buffer, buf2: Buffer): number; 154 | }; 155 | 156 | /************************************************ 157 | * * 158 | * GLOBAL INTERFACES * 159 | * * 160 | ************************************************/ 161 | declare module NodeJS { 162 | export interface ErrnoException extends Error { 163 | errno?: number; 164 | code?: string; 165 | path?: string; 166 | syscall?: string; 167 | stack?: string; 168 | } 169 | 170 | export interface EventEmitter { 171 | addListener(event: string, listener: Function): EventEmitter; 172 | on(event: string, listener: Function): EventEmitter; 173 | once(event: string, listener: Function): EventEmitter; 174 | removeListener(event: string, listener: Function): EventEmitter; 175 | removeAllListeners(event?: string): EventEmitter; 176 | setMaxListeners(n: number): void; 177 | listeners(event: string): Function[]; 178 | emit(event: string, ...args: any[]): boolean; 179 | } 180 | 181 | export interface ReadableStream extends EventEmitter { 182 | readable: boolean; 183 | read(size?: number): string|Buffer; 184 | setEncoding(encoding: string): void; 185 | pause(): void; 186 | resume(): void; 187 | pipe(destination: T, options?: { end?: boolean; }): T; 188 | unpipe(destination?: T): void; 189 | unshift(chunk: string): void; 190 | unshift(chunk: Buffer): void; 191 | wrap(oldStream: ReadableStream): ReadableStream; 192 | } 193 | 194 | export interface WritableStream extends EventEmitter { 195 | writable: boolean; 196 | write(buffer: Buffer, cb?: Function): boolean; 197 | write(str: string, cb?: Function): boolean; 198 | write(str: string, encoding?: string, cb?: Function): boolean; 199 | end(): void; 200 | end(buffer: Buffer, cb?: Function): void; 201 | end(str: string, cb?: Function): void; 202 | end(str: string, encoding?: string, cb?: Function): void; 203 | } 204 | 205 | export interface ReadWriteStream extends ReadableStream, WritableStream {} 206 | 207 | export interface Process extends EventEmitter { 208 | stdout: WritableStream; 209 | stderr: WritableStream; 210 | stdin: ReadableStream; 211 | argv: string[]; 212 | execPath: string; 213 | abort(): void; 214 | chdir(directory: string): void; 215 | cwd(): string; 216 | env: any; 217 | exit(code?: number): void; 218 | getgid(): number; 219 | setgid(id: number): void; 220 | setgid(id: string): void; 221 | getuid(): number; 222 | setuid(id: number): void; 223 | setuid(id: string): void; 224 | version: string; 225 | versions: { 226 | http_parser: string; 227 | node: string; 228 | v8: string; 229 | ares: string; 230 | uv: string; 231 | zlib: string; 232 | openssl: string; 233 | }; 234 | config: { 235 | target_defaults: { 236 | cflags: any[]; 237 | default_configuration: string; 238 | defines: string[]; 239 | include_dirs: string[]; 240 | libraries: string[]; 241 | }; 242 | variables: { 243 | clang: number; 244 | host_arch: string; 245 | node_install_npm: boolean; 246 | node_install_waf: boolean; 247 | node_prefix: string; 248 | node_shared_openssl: boolean; 249 | node_shared_v8: boolean; 250 | node_shared_zlib: boolean; 251 | node_use_dtrace: boolean; 252 | node_use_etw: boolean; 253 | node_use_openssl: boolean; 254 | target_arch: string; 255 | v8_no_strict_aliasing: number; 256 | v8_use_snapshot: boolean; 257 | visibility: string; 258 | }; 259 | }; 260 | kill(pid: number, signal?: string): void; 261 | pid: number; 262 | title: string; 263 | arch: string; 264 | platform: string; 265 | memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; 266 | nextTick(callback: Function): void; 267 | umask(mask?: number): number; 268 | uptime(): number; 269 | hrtime(time?:number[]): number[]; 270 | 271 | // Worker 272 | send?(message: any, sendHandle?: any): void; 273 | } 274 | 275 | export interface Global { 276 | Array: typeof Array; 277 | ArrayBuffer: typeof ArrayBuffer; 278 | Boolean: typeof Boolean; 279 | Buffer: typeof Buffer; 280 | DataView: typeof DataView; 281 | Date: typeof Date; 282 | Error: typeof Error; 283 | EvalError: typeof EvalError; 284 | Float32Array: typeof Float32Array; 285 | Float64Array: typeof Float64Array; 286 | Function: typeof Function; 287 | GLOBAL: Global; 288 | Infinity: typeof Infinity; 289 | Int16Array: typeof Int16Array; 290 | Int32Array: typeof Int32Array; 291 | Int8Array: typeof Int8Array; 292 | Intl: typeof Intl; 293 | JSON: typeof JSON; 294 | Map: MapConstructor; 295 | Math: typeof Math; 296 | NaN: typeof NaN; 297 | Number: typeof Number; 298 | Object: typeof Object; 299 | Promise: Function; 300 | RangeError: typeof RangeError; 301 | ReferenceError: typeof ReferenceError; 302 | RegExp: typeof RegExp; 303 | Set: SetConstructor; 304 | String: typeof String; 305 | Symbol: Function; 306 | SyntaxError: typeof SyntaxError; 307 | TypeError: typeof TypeError; 308 | URIError: typeof URIError; 309 | Uint16Array: typeof Uint16Array; 310 | Uint32Array: typeof Uint32Array; 311 | Uint8Array: typeof Uint8Array; 312 | Uint8ClampedArray: Function; 313 | WeakMap: WeakMapConstructor; 314 | WeakSet: WeakSetConstructor; 315 | clearImmediate: (immediateId: any) => void; 316 | clearInterval: (intervalId: NodeJS.Timer) => void; 317 | clearTimeout: (timeoutId: NodeJS.Timer) => void; 318 | console: typeof console; 319 | decodeURI: typeof decodeURI; 320 | decodeURIComponent: typeof decodeURIComponent; 321 | encodeURI: typeof encodeURI; 322 | encodeURIComponent: typeof encodeURIComponent; 323 | escape: (str: string) => string; 324 | eval: typeof eval; 325 | global: Global; 326 | isFinite: typeof isFinite; 327 | isNaN: typeof isNaN; 328 | parseFloat: typeof parseFloat; 329 | parseInt: typeof parseInt; 330 | process: Process; 331 | root: Global; 332 | setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any; 333 | setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; 334 | setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; 335 | undefined: typeof undefined; 336 | unescape: (str: string) => string; 337 | gc: () => void; 338 | } 339 | 340 | export interface Timer { 341 | ref() : void; 342 | unref() : void; 343 | } 344 | } 345 | 346 | /** 347 | * @deprecated 348 | */ 349 | interface NodeBuffer { 350 | [index: number]: number; 351 | write(string: string, offset?: number, length?: number, encoding?: string): number; 352 | toString(encoding?: string, start?: number, end?: number): string; 353 | toJSON(): any; 354 | length: number; 355 | equals(otherBuffer: Buffer): boolean; 356 | compare(otherBuffer: Buffer): number; 357 | copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; 358 | slice(start?: number, end?: number): Buffer; 359 | writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; 360 | writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; 361 | writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; 362 | writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; 363 | readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; 364 | readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; 365 | readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; 366 | readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; 367 | readUInt8(offset: number, noAsset?: boolean): number; 368 | readUInt16LE(offset: number, noAssert?: boolean): number; 369 | readUInt16BE(offset: number, noAssert?: boolean): number; 370 | readUInt32LE(offset: number, noAssert?: boolean): number; 371 | readUInt32BE(offset: number, noAssert?: boolean): number; 372 | readInt8(offset: number, noAssert?: boolean): number; 373 | readInt16LE(offset: number, noAssert?: boolean): number; 374 | readInt16BE(offset: number, noAssert?: boolean): number; 375 | readInt32LE(offset: number, noAssert?: boolean): number; 376 | readInt32BE(offset: number, noAssert?: boolean): number; 377 | readFloatLE(offset: number, noAssert?: boolean): number; 378 | readFloatBE(offset: number, noAssert?: boolean): number; 379 | readDoubleLE(offset: number, noAssert?: boolean): number; 380 | readDoubleBE(offset: number, noAssert?: boolean): number; 381 | writeUInt8(value: number, offset: number, noAssert?: boolean): void; 382 | writeUInt16LE(value: number, offset: number, noAssert?: boolean): void; 383 | writeUInt16BE(value: number, offset: number, noAssert?: boolean): void; 384 | writeUInt32LE(value: number, offset: number, noAssert?: boolean): void; 385 | writeUInt32BE(value: number, offset: number, noAssert?: boolean): void; 386 | writeInt8(value: number, offset: number, noAssert?: boolean): void; 387 | writeInt16LE(value: number, offset: number, noAssert?: boolean): void; 388 | writeInt16BE(value: number, offset: number, noAssert?: boolean): void; 389 | writeInt32LE(value: number, offset: number, noAssert?: boolean): void; 390 | writeInt32BE(value: number, offset: number, noAssert?: boolean): void; 391 | writeFloatLE(value: number, offset: number, noAssert?: boolean): void; 392 | writeFloatBE(value: number, offset: number, noAssert?: boolean): void; 393 | writeDoubleLE(value: number, offset: number, noAssert?: boolean): void; 394 | writeDoubleBE(value: number, offset: number, noAssert?: boolean): void; 395 | fill(value: any, offset?: number, end?: number): void; 396 | } 397 | 398 | /************************************************ 399 | * * 400 | * MODULES * 401 | * * 402 | ************************************************/ 403 | declare module "buffer" { 404 | export var INSPECT_MAX_BYTES: number; 405 | } 406 | 407 | declare module "querystring" { 408 | export function stringify(obj: any, sep?: string, eq?: string): string; 409 | export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any; 410 | export function escape(str: string): string; 411 | export function unescape(str: string): string; 412 | } 413 | 414 | declare module "events" { 415 | export class EventEmitter implements NodeJS.EventEmitter { 416 | static listenerCount(emitter: EventEmitter, event: string): number; 417 | 418 | addListener(event: string, listener: Function): EventEmitter; 419 | on(event: string, listener: Function): EventEmitter; 420 | once(event: string, listener: Function): EventEmitter; 421 | removeListener(event: string, listener: Function): EventEmitter; 422 | removeAllListeners(event?: string): EventEmitter; 423 | setMaxListeners(n: number): void; 424 | listeners(event: string): Function[]; 425 | emit(event: string, ...args: any[]): boolean; 426 | } 427 | } 428 | 429 | declare module "http" { 430 | import * as events from "events"; 431 | import * as net from "net"; 432 | import * as stream from "stream"; 433 | 434 | export interface Server extends events.EventEmitter { 435 | listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server; 436 | listen(port: number, hostname?: string, callback?: Function): Server; 437 | listen(path: string, callback?: Function): Server; 438 | listen(handle: any, listeningListener?: Function): Server; 439 | close(cb?: any): Server; 440 | address(): { port: number; family: string; address: string; }; 441 | maxHeadersCount: number; 442 | } 443 | /** 444 | * @deprecated Use IncomingMessage 445 | */ 446 | export interface ServerRequest extends IncomingMessage { 447 | connection: net.Socket; 448 | } 449 | export interface ServerResponse extends events.EventEmitter, stream.Writable { 450 | // Extended base methods 451 | write(buffer: Buffer): boolean; 452 | write(buffer: Buffer, cb?: Function): boolean; 453 | write(str: string, cb?: Function): boolean; 454 | write(str: string, encoding?: string, cb?: Function): boolean; 455 | write(str: string, encoding?: string, fd?: string): boolean; 456 | 457 | writeContinue(): void; 458 | writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void; 459 | writeHead(statusCode: number, headers?: any): void; 460 | statusCode: number; 461 | statusMessage: string; 462 | setHeader(name: string, value: string): void; 463 | sendDate: boolean; 464 | getHeader(name: string): string; 465 | removeHeader(name: string): void; 466 | write(chunk: any, encoding?: string): any; 467 | addTrailers(headers: any): void; 468 | 469 | // Extended base methods 470 | end(): void; 471 | end(buffer: Buffer, cb?: Function): void; 472 | end(str: string, cb?: Function): void; 473 | end(str: string, encoding?: string, cb?: Function): void; 474 | end(data?: any, encoding?: string): void; 475 | } 476 | export interface ClientRequest extends events.EventEmitter, stream.Writable { 477 | // Extended base methods 478 | write(buffer: Buffer): boolean; 479 | write(buffer: Buffer, cb?: Function): boolean; 480 | write(str: string, cb?: Function): boolean; 481 | write(str: string, encoding?: string, cb?: Function): boolean; 482 | write(str: string, encoding?: string, fd?: string): boolean; 483 | 484 | write(chunk: any, encoding?: string): void; 485 | abort(): void; 486 | setTimeout(timeout: number, callback?: Function): void; 487 | setNoDelay(noDelay?: boolean): void; 488 | setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; 489 | 490 | // Extended base methods 491 | end(): void; 492 | end(buffer: Buffer, cb?: Function): void; 493 | end(str: string, cb?: Function): void; 494 | end(str: string, encoding?: string, cb?: Function): void; 495 | end(data?: any, encoding?: string): void; 496 | } 497 | export interface IncomingMessage extends events.EventEmitter, stream.Readable { 498 | httpVersion: string; 499 | headers: any; 500 | rawHeaders: string[]; 501 | trailers: any; 502 | rawTrailers: any; 503 | setTimeout(msecs: number, callback: Function): NodeJS.Timer; 504 | /** 505 | * Only valid for request obtained from http.Server. 506 | */ 507 | method?: string; 508 | /** 509 | * Only valid for request obtained from http.Server. 510 | */ 511 | url?: string; 512 | /** 513 | * Only valid for response obtained from http.ClientRequest. 514 | */ 515 | statusCode?: number; 516 | /** 517 | * Only valid for response obtained from http.ClientRequest. 518 | */ 519 | statusMessage?: string; 520 | socket: net.Socket; 521 | } 522 | /** 523 | * @deprecated Use IncomingMessage 524 | */ 525 | export interface ClientResponse extends IncomingMessage { } 526 | 527 | export interface AgentOptions { 528 | /** 529 | * Keep sockets around in a pool to be used by other requests in the future. Default = false 530 | */ 531 | keepAlive?: boolean; 532 | /** 533 | * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. 534 | * Only relevant if keepAlive is set to true. 535 | */ 536 | keepAliveMsecs?: number; 537 | /** 538 | * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity 539 | */ 540 | maxSockets?: number; 541 | /** 542 | * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. 543 | */ 544 | maxFreeSockets?: number; 545 | } 546 | 547 | export class Agent { 548 | maxSockets: number; 549 | sockets: any; 550 | requests: any; 551 | 552 | constructor(opts?: AgentOptions); 553 | 554 | /** 555 | * Destroy any sockets that are currently in use by the agent. 556 | * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, 557 | * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, 558 | * sockets may hang open for quite a long time before the server terminates them. 559 | */ 560 | destroy(): void; 561 | } 562 | 563 | export var METHODS: string[]; 564 | 565 | export var STATUS_CODES: { 566 | [errorCode: number]: string; 567 | [errorCode: string]: string; 568 | }; 569 | export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server; 570 | export function createClient(port?: number, host?: string): any; 571 | export function request(options: any, callback?: (res: IncomingMessage) => void): ClientRequest; 572 | export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest; 573 | export var globalAgent: Agent; 574 | } 575 | 576 | declare module "cluster" { 577 | import * as child from "child_process"; 578 | import * as events from "events"; 579 | 580 | export interface ClusterSettings { 581 | exec?: string; 582 | args?: string[]; 583 | silent?: boolean; 584 | } 585 | 586 | export class Worker extends events.EventEmitter { 587 | id: string; 588 | process: child.ChildProcess; 589 | suicide: boolean; 590 | send(message: any, sendHandle?: any): void; 591 | kill(signal?: string): void; 592 | destroy(signal?: string): void; 593 | disconnect(): void; 594 | } 595 | 596 | export var settings: ClusterSettings; 597 | export var isMaster: boolean; 598 | export var isWorker: boolean; 599 | export function setupMaster(settings?: ClusterSettings): void; 600 | export function fork(env?: any): Worker; 601 | export function disconnect(callback?: Function): void; 602 | export var worker: Worker; 603 | export var workers: Worker[]; 604 | 605 | // Event emitter 606 | export function addListener(event: string, listener: Function): void; 607 | export function on(event: string, listener: Function): any; 608 | export function once(event: string, listener: Function): void; 609 | export function removeListener(event: string, listener: Function): void; 610 | export function removeAllListeners(event?: string): void; 611 | export function setMaxListeners(n: number): void; 612 | export function listeners(event: string): Function[]; 613 | export function emit(event: string, ...args: any[]): boolean; 614 | } 615 | 616 | declare module "zlib" { 617 | import * as stream from "stream"; 618 | export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; } 619 | 620 | export interface Gzip extends stream.Transform { } 621 | export interface Gunzip extends stream.Transform { } 622 | export interface Deflate extends stream.Transform { } 623 | export interface Inflate extends stream.Transform { } 624 | export interface DeflateRaw extends stream.Transform { } 625 | export interface InflateRaw extends stream.Transform { } 626 | export interface Unzip extends stream.Transform { } 627 | 628 | export function createGzip(options?: ZlibOptions): Gzip; 629 | export function createGunzip(options?: ZlibOptions): Gunzip; 630 | export function createDeflate(options?: ZlibOptions): Deflate; 631 | export function createInflate(options?: ZlibOptions): Inflate; 632 | export function createDeflateRaw(options?: ZlibOptions): DeflateRaw; 633 | export function createInflateRaw(options?: ZlibOptions): InflateRaw; 634 | export function createUnzip(options?: ZlibOptions): Unzip; 635 | 636 | export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; 637 | export function deflateSync(buf: Buffer, options?: ZlibOptions): any; 638 | export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; 639 | export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any; 640 | export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; 641 | export function gzipSync(buf: Buffer, options?: ZlibOptions): any; 642 | export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; 643 | export function gunzipSync(buf: Buffer, options?: ZlibOptions): any; 644 | export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; 645 | export function inflateSync(buf: Buffer, options?: ZlibOptions): any; 646 | export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; 647 | export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any; 648 | export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; 649 | export function unzipSync(buf: Buffer, options?: ZlibOptions): any; 650 | 651 | // Constants 652 | export var Z_NO_FLUSH: number; 653 | export var Z_PARTIAL_FLUSH: number; 654 | export var Z_SYNC_FLUSH: number; 655 | export var Z_FULL_FLUSH: number; 656 | export var Z_FINISH: number; 657 | export var Z_BLOCK: number; 658 | export var Z_TREES: number; 659 | export var Z_OK: number; 660 | export var Z_STREAM_END: number; 661 | export var Z_NEED_DICT: number; 662 | export var Z_ERRNO: number; 663 | export var Z_STREAM_ERROR: number; 664 | export var Z_DATA_ERROR: number; 665 | export var Z_MEM_ERROR: number; 666 | export var Z_BUF_ERROR: number; 667 | export var Z_VERSION_ERROR: number; 668 | export var Z_NO_COMPRESSION: number; 669 | export var Z_BEST_SPEED: number; 670 | export var Z_BEST_COMPRESSION: number; 671 | export var Z_DEFAULT_COMPRESSION: number; 672 | export var Z_FILTERED: number; 673 | export var Z_HUFFMAN_ONLY: number; 674 | export var Z_RLE: number; 675 | export var Z_FIXED: number; 676 | export var Z_DEFAULT_STRATEGY: number; 677 | export var Z_BINARY: number; 678 | export var Z_TEXT: number; 679 | export var Z_ASCII: number; 680 | export var Z_UNKNOWN: number; 681 | export var Z_DEFLATED: number; 682 | export var Z_NULL: number; 683 | } 684 | 685 | declare module "os" { 686 | export function tmpdir(): string; 687 | export function hostname(): string; 688 | export function type(): string; 689 | export function platform(): string; 690 | export function arch(): string; 691 | export function release(): string; 692 | export function uptime(): number; 693 | export function loadavg(): number[]; 694 | export function totalmem(): number; 695 | export function freemem(): number; 696 | export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[]; 697 | export function networkInterfaces(): any; 698 | export var EOL: string; 699 | } 700 | 701 | declare module "https" { 702 | import * as tls from "tls"; 703 | import * as events from "events"; 704 | import * as http from "http"; 705 | 706 | export interface ServerOptions { 707 | pfx?: any; 708 | key?: any; 709 | passphrase?: string; 710 | cert?: any; 711 | ca?: any; 712 | crl?: any; 713 | ciphers?: string; 714 | honorCipherOrder?: boolean; 715 | requestCert?: boolean; 716 | rejectUnauthorized?: boolean; 717 | NPNProtocols?: any; 718 | SNICallback?: (servername: string) => any; 719 | } 720 | 721 | export interface RequestOptions { 722 | host?: string; 723 | hostname?: string; 724 | port?: number; 725 | path?: string; 726 | method?: string; 727 | headers?: any; 728 | auth?: string; 729 | agent?: any; 730 | pfx?: any; 731 | key?: any; 732 | passphrase?: string; 733 | cert?: any; 734 | ca?: any; 735 | ciphers?: string; 736 | rejectUnauthorized?: boolean; 737 | } 738 | 739 | export interface Agent { 740 | maxSockets: number; 741 | sockets: any; 742 | requests: any; 743 | } 744 | export var Agent: { 745 | new (options?: RequestOptions): Agent; 746 | }; 747 | export interface Server extends tls.Server { } 748 | export function createServer(options: ServerOptions, requestListener?: Function): Server; 749 | export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; 750 | export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; 751 | export var globalAgent: Agent; 752 | } 753 | 754 | declare module "punycode" { 755 | export function decode(string: string): string; 756 | export function encode(string: string): string; 757 | export function toUnicode(domain: string): string; 758 | export function toASCII(domain: string): string; 759 | export var ucs2: ucs2; 760 | interface ucs2 { 761 | decode(string: string): string; 762 | encode(codePoints: number[]): string; 763 | } 764 | export var version: any; 765 | } 766 | 767 | declare module "repl" { 768 | import * as stream from "stream"; 769 | import * as events from "events"; 770 | 771 | export interface ReplOptions { 772 | prompt?: string; 773 | input?: NodeJS.ReadableStream; 774 | output?: NodeJS.WritableStream; 775 | terminal?: boolean; 776 | eval?: Function; 777 | useColors?: boolean; 778 | useGlobal?: boolean; 779 | ignoreUndefined?: boolean; 780 | writer?: Function; 781 | } 782 | export function start(options: ReplOptions): events.EventEmitter; 783 | } 784 | 785 | declare module "readline" { 786 | import * as events from "events"; 787 | import * as stream from "stream"; 788 | 789 | export interface ReadLine extends events.EventEmitter { 790 | setPrompt(prompt: string): void; 791 | prompt(preserveCursor?: boolean): void; 792 | question(query: string, callback: Function): void; 793 | pause(): void; 794 | resume(): void; 795 | close(): void; 796 | write(data: any, key?: any): void; 797 | } 798 | export interface ReadLineOptions { 799 | input: NodeJS.ReadableStream; 800 | output: NodeJS.WritableStream; 801 | completer?: Function; 802 | terminal?: boolean; 803 | } 804 | export function createInterface(options: ReadLineOptions): ReadLine; 805 | } 806 | 807 | declare module "vm" { 808 | export interface Context { } 809 | export interface Script { 810 | runInThisContext(): void; 811 | runInNewContext(sandbox?: Context): void; 812 | } 813 | export function runInThisContext(code: string, filename?: string): void; 814 | export function runInNewContext(code: string, sandbox?: Context, filename?: string): void; 815 | export function runInContext(code: string, context: Context, filename?: string): void; 816 | export function createContext(initSandbox?: Context): Context; 817 | export function createScript(code: string, filename?: string): Script; 818 | } 819 | 820 | declare module "child_process" { 821 | import * as events from "events"; 822 | import * as stream from "stream"; 823 | 824 | export interface ChildProcess extends events.EventEmitter { 825 | stdin: stream.Writable; 826 | stdout: stream.Readable; 827 | stderr: stream.Readable; 828 | pid: number; 829 | kill(signal?: string): void; 830 | send(message: any, sendHandle?: any): void; 831 | disconnect(): void; 832 | unref(): void; 833 | } 834 | 835 | export function spawn(command: string, args?: string[], options?: { 836 | cwd?: string; 837 | stdio?: any; 838 | custom?: any; 839 | env?: any; 840 | detached?: boolean; 841 | }): ChildProcess; 842 | export function exec(command: string, options: { 843 | cwd?: string; 844 | stdio?: any; 845 | customFds?: any; 846 | env?: any; 847 | encoding?: string; 848 | timeout?: number; 849 | maxBuffer?: number; 850 | killSignal?: string; 851 | }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; 852 | export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; 853 | export function execFile(file: string, 854 | callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; 855 | export function execFile(file: string, args?: string[], 856 | callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; 857 | export function execFile(file: string, args?: string[], options?: { 858 | cwd?: string; 859 | stdio?: any; 860 | customFds?: any; 861 | env?: any; 862 | encoding?: string; 863 | timeout?: number; 864 | maxBuffer?: string; 865 | killSignal?: string; 866 | }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; 867 | export function fork(modulePath: string, args?: string[], options?: { 868 | cwd?: string; 869 | env?: any; 870 | encoding?: string; 871 | }): ChildProcess; 872 | export function execSync(command: string, options?: { 873 | cwd?: string; 874 | input?: string|Buffer; 875 | stdio?: any; 876 | env?: any; 877 | uid?: number; 878 | gid?: number; 879 | timeout?: number; 880 | maxBuffer?: number; 881 | killSignal?: string; 882 | encoding?: string; 883 | }): ChildProcess; 884 | export function execFileSync(command: string, args?: string[], options?: { 885 | cwd?: string; 886 | input?: string|Buffer; 887 | stdio?: any; 888 | env?: any; 889 | uid?: number; 890 | gid?: number; 891 | timeout?: number; 892 | maxBuffer?: number; 893 | killSignal?: string; 894 | encoding?: string; 895 | }): ChildProcess; 896 | } 897 | 898 | declare module "url" { 899 | export interface Url { 900 | href: string; 901 | protocol: string; 902 | auth: string; 903 | hostname: string; 904 | port: string; 905 | host: string; 906 | pathname: string; 907 | search: string; 908 | query: any; // string | Object 909 | slashes: boolean; 910 | hash?: string; 911 | path?: string; 912 | } 913 | 914 | export interface UrlOptions { 915 | protocol?: string; 916 | auth?: string; 917 | hostname?: string; 918 | port?: string; 919 | host?: string; 920 | pathname?: string; 921 | search?: string; 922 | query?: any; 923 | hash?: string; 924 | path?: string; 925 | } 926 | 927 | export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url; 928 | export function format(url: UrlOptions): string; 929 | export function resolve(from: string, to: string): string; 930 | } 931 | 932 | declare module "dns" { 933 | export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string; 934 | export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string; 935 | export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 936 | export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 937 | export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 938 | export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 939 | export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 940 | export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 941 | export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 942 | export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 943 | export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; 944 | export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[]; 945 | } 946 | 947 | declare module "net" { 948 | import * as stream from "stream"; 949 | 950 | export interface Socket extends stream.Duplex { 951 | // Extended base methods 952 | write(buffer: Buffer): boolean; 953 | write(buffer: Buffer, cb?: Function): boolean; 954 | write(str: string, cb?: Function): boolean; 955 | write(str: string, encoding?: string, cb?: Function): boolean; 956 | write(str: string, encoding?: string, fd?: string): boolean; 957 | 958 | connect(port: number, host?: string, connectionListener?: Function): void; 959 | connect(path: string, connectionListener?: Function): void; 960 | bufferSize: number; 961 | setEncoding(encoding?: string): void; 962 | write(data: any, encoding?: string, callback?: Function): void; 963 | destroy(): void; 964 | pause(): void; 965 | resume(): void; 966 | setTimeout(timeout: number, callback?: Function): void; 967 | setNoDelay(noDelay?: boolean): void; 968 | setKeepAlive(enable?: boolean, initialDelay?: number): void; 969 | address(): { port: number; family: string; address: string; }; 970 | unref(): void; 971 | ref(): void; 972 | 973 | remoteAddress: string; 974 | remoteFamily: string; 975 | remotePort: number; 976 | localAddress: string; 977 | localPort: number; 978 | bytesRead: number; 979 | bytesWritten: number; 980 | 981 | // Extended base methods 982 | end(): void; 983 | end(buffer: Buffer, cb?: Function): void; 984 | end(str: string, cb?: Function): void; 985 | end(str: string, encoding?: string, cb?: Function): void; 986 | end(data?: any, encoding?: string): void; 987 | } 988 | 989 | export var Socket: { 990 | new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): Socket; 991 | }; 992 | 993 | export interface Server extends Socket { 994 | listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server; 995 | listen(path: string, listeningListener?: Function): Server; 996 | listen(handle: any, listeningListener?: Function): Server; 997 | close(callback?: Function): Server; 998 | address(): { port: number; family: string; address: string; }; 999 | maxConnections: number; 1000 | connections: number; 1001 | } 1002 | export function createServer(connectionListener?: (socket: Socket) =>void ): Server; 1003 | export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server; 1004 | export function connect(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): Socket; 1005 | export function connect(port: number, host?: string, connectionListener?: Function): Socket; 1006 | export function connect(path: string, connectionListener?: Function): Socket; 1007 | export function createConnection(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): Socket; 1008 | export function createConnection(port: number, host?: string, connectionListener?: Function): Socket; 1009 | export function createConnection(path: string, connectionListener?: Function): Socket; 1010 | export function isIP(input: string): number; 1011 | export function isIPv4(input: string): boolean; 1012 | export function isIPv6(input: string): boolean; 1013 | } 1014 | 1015 | declare module "dgram" { 1016 | import * as events from "events"; 1017 | 1018 | interface RemoteInfo { 1019 | address: string; 1020 | port: number; 1021 | size: number; 1022 | } 1023 | 1024 | interface AddressInfo { 1025 | address: string; 1026 | family: string; 1027 | port: number; 1028 | } 1029 | 1030 | export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; 1031 | 1032 | interface Socket extends events.EventEmitter { 1033 | send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; 1034 | bind(port: number, address?: string, callback?: () => void): void; 1035 | close(): void; 1036 | address(): AddressInfo; 1037 | setBroadcast(flag: boolean): void; 1038 | setMulticastTTL(ttl: number): void; 1039 | setMulticastLoopback(flag: boolean): void; 1040 | addMembership(multicastAddress: string, multicastInterface?: string): void; 1041 | dropMembership(multicastAddress: string, multicastInterface?: string): void; 1042 | } 1043 | } 1044 | 1045 | declare module "fs" { 1046 | import * as stream from "stream"; 1047 | import * as events from "events"; 1048 | 1049 | interface Stats { 1050 | isFile(): boolean; 1051 | isDirectory(): boolean; 1052 | isBlockDevice(): boolean; 1053 | isCharacterDevice(): boolean; 1054 | isSymbolicLink(): boolean; 1055 | isFIFO(): boolean; 1056 | isSocket(): boolean; 1057 | dev: number; 1058 | ino: number; 1059 | mode: number; 1060 | nlink: number; 1061 | uid: number; 1062 | gid: number; 1063 | rdev: number; 1064 | size: number; 1065 | blksize: number; 1066 | blocks: number; 1067 | atime: Date; 1068 | mtime: Date; 1069 | ctime: Date; 1070 | birthtime: Date; 1071 | } 1072 | 1073 | interface FSWatcher extends events.EventEmitter { 1074 | close(): void; 1075 | } 1076 | 1077 | export interface ReadStream extends stream.Readable { 1078 | close(): void; 1079 | } 1080 | export interface WriteStream extends stream.Writable { 1081 | close(): void; 1082 | bytesWritten: number; 1083 | } 1084 | 1085 | /** 1086 | * Asynchronous rename. 1087 | * @param oldPath 1088 | * @param newPath 1089 | * @param callback No arguments other than a possible exception are given to the completion callback. 1090 | */ 1091 | export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1092 | /** 1093 | * Synchronous rename 1094 | * @param oldPath 1095 | * @param newPath 1096 | */ 1097 | export function renameSync(oldPath: string, newPath: string): void; 1098 | export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1099 | export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1100 | export function truncateSync(path: string, len?: number): void; 1101 | export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1102 | export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1103 | export function ftruncateSync(fd: number, len?: number): void; 1104 | export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1105 | export function chownSync(path: string, uid: number, gid: number): void; 1106 | export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1107 | export function fchownSync(fd: number, uid: number, gid: number): void; 1108 | export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1109 | export function lchownSync(path: string, uid: number, gid: number): void; 1110 | export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1111 | export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1112 | export function chmodSync(path: string, mode: number): void; 1113 | export function chmodSync(path: string, mode: string): void; 1114 | export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1115 | export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1116 | export function fchmodSync(fd: number, mode: number): void; 1117 | export function fchmodSync(fd: number, mode: string): void; 1118 | export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1119 | export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1120 | export function lchmodSync(path: string, mode: number): void; 1121 | export function lchmodSync(path: string, mode: string): void; 1122 | export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; 1123 | export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; 1124 | export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; 1125 | export function statSync(path: string): Stats; 1126 | export function lstatSync(path: string): Stats; 1127 | export function fstatSync(fd: number): Stats; 1128 | export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1129 | export function linkSync(srcpath: string, dstpath: string): void; 1130 | export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1131 | export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; 1132 | export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; 1133 | export function readlinkSync(path: string): string; 1134 | export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; 1135 | export function realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void; 1136 | export function realpathSync(path: string, cache?: { [path: string]: string }): string; 1137 | /* 1138 | * Asynchronous unlink - deletes the file specified in {path} 1139 | * 1140 | * @param path 1141 | * @param callback No arguments other than a possible exception are given to the completion callback. 1142 | */ 1143 | export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1144 | /* 1145 | * Synchronous unlink - deletes the file specified in {path} 1146 | * 1147 | * @param path 1148 | */ 1149 | export function unlinkSync(path: string): void; 1150 | /* 1151 | * Asynchronous rmdir - removes the directory specified in {path} 1152 | * 1153 | * @param path 1154 | * @param callback No arguments other than a possible exception are given to the completion callback. 1155 | */ 1156 | export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1157 | /* 1158 | * Synchronous rmdir - removes the directory specified in {path} 1159 | * 1160 | * @param path 1161 | */ 1162 | export function rmdirSync(path: string): void; 1163 | /* 1164 | * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. 1165 | * 1166 | * @param path 1167 | * @param callback No arguments other than a possible exception are given to the completion callback. 1168 | */ 1169 | export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1170 | /* 1171 | * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. 1172 | * 1173 | * @param path 1174 | * @param mode 1175 | * @param callback No arguments other than a possible exception are given to the completion callback. 1176 | */ 1177 | export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1178 | /* 1179 | * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. 1180 | * 1181 | * @param path 1182 | * @param mode 1183 | * @param callback No arguments other than a possible exception are given to the completion callback. 1184 | */ 1185 | export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; 1186 | /* 1187 | * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. 1188 | * 1189 | * @param path 1190 | * @param mode 1191 | * @param callback No arguments other than a possible exception are given to the completion callback. 1192 | */ 1193 | export function mkdirSync(path: string, mode?: number): void; 1194 | /* 1195 | * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. 1196 | * 1197 | * @param path 1198 | * @param mode 1199 | * @param callback No arguments other than a possible exception are given to the completion callback. 1200 | */ 1201 | export function mkdirSync(path: string, mode?: string): void; 1202 | export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; 1203 | export function readdirSync(path: string): string[]; 1204 | export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1205 | export function closeSync(fd: number): void; 1206 | export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; 1207 | export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; 1208 | export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; 1209 | export function openSync(path: string, flags: string, mode?: number): number; 1210 | export function openSync(path: string, flags: string, mode?: string): number; 1211 | export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1212 | export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; 1213 | export function utimesSync(path: string, atime: number, mtime: number): void; 1214 | export function utimesSync(path: string, atime: Date, mtime: Date): void; 1215 | export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1216 | export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; 1217 | export function futimesSync(fd: number, atime: number, mtime: number): void; 1218 | export function futimesSync(fd: number, atime: Date, mtime: Date): void; 1219 | export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; 1220 | export function fsyncSync(fd: number): void; 1221 | export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; 1222 | export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; 1223 | export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; 1224 | export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; 1225 | export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; 1226 | export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; 1227 | export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; 1228 | export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; 1229 | /* 1230 | * Asynchronous readFile - Asynchronously reads the entire contents of a file. 1231 | * 1232 | * @param fileName 1233 | * @param encoding 1234 | * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. 1235 | */ 1236 | export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; 1237 | /* 1238 | * Asynchronous readFile - Asynchronously reads the entire contents of a file. 1239 | * 1240 | * @param fileName 1241 | * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. 1242 | * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. 1243 | */ 1244 | export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; 1245 | /* 1246 | * Asynchronous readFile - Asynchronously reads the entire contents of a file. 1247 | * 1248 | * @param fileName 1249 | * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. 1250 | * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. 1251 | */ 1252 | export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; 1253 | /* 1254 | * Asynchronous readFile - Asynchronously reads the entire contents of a file. 1255 | * 1256 | * @param fileName 1257 | * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. 1258 | */ 1259 | export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; 1260 | /* 1261 | * Synchronous readFile - Synchronously reads the entire contents of a file. 1262 | * 1263 | * @param fileName 1264 | * @param encoding 1265 | */ 1266 | export function readFileSync(filename: string, encoding: string): string; 1267 | /* 1268 | * Synchronous readFile - Synchronously reads the entire contents of a file. 1269 | * 1270 | * @param fileName 1271 | * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. 1272 | */ 1273 | export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; 1274 | /* 1275 | * Synchronous readFile - Synchronously reads the entire contents of a file. 1276 | * 1277 | * @param fileName 1278 | * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. 1279 | */ 1280 | export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; 1281 | export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; 1282 | export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; 1283 | export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; 1284 | export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; 1285 | export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; 1286 | export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; 1287 | export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; 1288 | export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; 1289 | export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; 1290 | export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; 1291 | export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; 1292 | export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; 1293 | export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; 1294 | export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; 1295 | export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; 1296 | export function exists(path: string, callback?: (exists: boolean) => void): void; 1297 | export function existsSync(path: string): boolean; 1298 | /** Constant for fs.access(). File is visible to the calling process. */ 1299 | export var F_OK: number; 1300 | /** Constant for fs.access(). File can be read by the calling process. */ 1301 | export var R_OK: number; 1302 | /** Constant for fs.access(). File can be written by the calling process. */ 1303 | export var W_OK: number; 1304 | /** Constant for fs.access(). File can be executed by the calling process. */ 1305 | export var X_OK: number; 1306 | /** Tests a user's permissions for the file specified by path. */ 1307 | export function access(path: string, callback: (err: NodeJS.ErrnoException) => void): void; 1308 | export function access(path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; 1309 | /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ 1310 | export function accessSync(path: string, mode ?: number): void; 1311 | export function createReadStream(path: string, options?: { 1312 | flags?: string; 1313 | encoding?: string; 1314 | fd?: string; 1315 | mode?: number; 1316 | bufferSize?: number; 1317 | }): ReadStream; 1318 | export function createReadStream(path: string, options?: { 1319 | flags?: string; 1320 | encoding?: string; 1321 | fd?: string; 1322 | mode?: string; 1323 | bufferSize?: number; 1324 | }): ReadStream; 1325 | export function createWriteStream(path: string, options?: { 1326 | flags?: string; 1327 | encoding?: string; 1328 | string?: string; 1329 | }): WriteStream; 1330 | } 1331 | 1332 | declare module "path" { 1333 | 1334 | /** 1335 | * A parsed path object generated by path.parse() or consumed by path.format(). 1336 | */ 1337 | export interface ParsedPath { 1338 | /** 1339 | * The root of the path such as '/' or 'c:\' 1340 | */ 1341 | root: string; 1342 | /** 1343 | * The full directory path such as '/home/user/dir' or 'c:\path\dir' 1344 | */ 1345 | dir: string; 1346 | /** 1347 | * The file name including extension (if any) such as 'index.html' 1348 | */ 1349 | base: string; 1350 | /** 1351 | * The file extension (if any) such as '.html' 1352 | */ 1353 | ext: string; 1354 | /** 1355 | * The file name without extension (if any) such as 'index' 1356 | */ 1357 | name: string; 1358 | } 1359 | 1360 | /** 1361 | * Normalize a string path, reducing '..' and '.' parts. 1362 | * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. 1363 | * 1364 | * @param p string path to normalize. 1365 | */ 1366 | export function normalize(p: string): string; 1367 | /** 1368 | * Join all arguments together and normalize the resulting path. 1369 | * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. 1370 | * 1371 | * @param paths string paths to join. 1372 | */ 1373 | export function join(...paths: any[]): string; 1374 | /** 1375 | * Join all arguments together and normalize the resulting path. 1376 | * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. 1377 | * 1378 | * @param paths string paths to join. 1379 | */ 1380 | export function join(...paths: string[]): string; 1381 | /** 1382 | * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. 1383 | * 1384 | * Starting from leftmost {from} paramter, resolves {to} to an absolute path. 1385 | * 1386 | * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. 1387 | * 1388 | * @param pathSegments string paths to join. Non-string arguments are ignored. 1389 | */ 1390 | export function resolve(...pathSegments: any[]): string; 1391 | /** 1392 | * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. 1393 | * 1394 | * @param path path to test. 1395 | */ 1396 | export function isAbsolute(path: string): boolean; 1397 | /** 1398 | * Solve the relative path from {from} to {to}. 1399 | * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. 1400 | * 1401 | * @param from 1402 | * @param to 1403 | */ 1404 | export function relative(from: string, to: string): string; 1405 | /** 1406 | * Return the directory name of a path. Similar to the Unix dirname command. 1407 | * 1408 | * @param p the path to evaluate. 1409 | */ 1410 | export function dirname(p: string): string; 1411 | /** 1412 | * Return the last portion of a path. Similar to the Unix basename command. 1413 | * Often used to extract the file name from a fully qualified path. 1414 | * 1415 | * @param p the path to evaluate. 1416 | * @param ext optionally, an extension to remove from the result. 1417 | */ 1418 | export function basename(p: string, ext?: string): string; 1419 | /** 1420 | * Return the extension of the path, from the last '.' to end of string in the last portion of the path. 1421 | * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string 1422 | * 1423 | * @param p the path to evaluate. 1424 | */ 1425 | export function extname(p: string): string; 1426 | /** 1427 | * The platform-specific file separator. '\\' or '/'. 1428 | */ 1429 | export var sep: string; 1430 | /** 1431 | * The platform-specific file delimiter. ';' or ':'. 1432 | */ 1433 | export var delimiter: string; 1434 | /** 1435 | * Returns an object from a path string - the opposite of format(). 1436 | * 1437 | * @param pathString path to evaluate. 1438 | */ 1439 | export function parse(pathString: string): ParsedPath; 1440 | /** 1441 | * Returns a path string from an object - the opposite of parse(). 1442 | * 1443 | * @param pathString path to evaluate. 1444 | */ 1445 | export function format(pathObject: ParsedPath): string; 1446 | 1447 | export module posix { 1448 | export function normalize(p: string): string; 1449 | export function join(...paths: any[]): string; 1450 | export function resolve(...pathSegments: any[]): string; 1451 | export function isAbsolute(p: string): boolean; 1452 | export function relative(from: string, to: string): string; 1453 | export function dirname(p: string): string; 1454 | export function basename(p: string, ext?: string): string; 1455 | export function extname(p: string): string; 1456 | export var sep: string; 1457 | export var delimiter: string; 1458 | export function parse(p: string): ParsedPath; 1459 | export function format(pP: ParsedPath): string; 1460 | } 1461 | 1462 | export module win32 { 1463 | export function normalize(p: string): string; 1464 | export function join(...paths: any[]): string; 1465 | export function resolve(...pathSegments: any[]): string; 1466 | export function isAbsolute(p: string): boolean; 1467 | export function relative(from: string, to: string): string; 1468 | export function dirname(p: string): string; 1469 | export function basename(p: string, ext?: string): string; 1470 | export function extname(p: string): string; 1471 | export var sep: string; 1472 | export var delimiter: string; 1473 | export function parse(p: string): ParsedPath; 1474 | export function format(pP: ParsedPath): string; 1475 | } 1476 | } 1477 | 1478 | declare module "string_decoder" { 1479 | export interface NodeStringDecoder { 1480 | write(buffer: Buffer): string; 1481 | detectIncompleteChar(buffer: Buffer): number; 1482 | } 1483 | export var StringDecoder: { 1484 | new (encoding: string): NodeStringDecoder; 1485 | }; 1486 | } 1487 | 1488 | declare module "tls" { 1489 | import * as crypto from "crypto"; 1490 | import * as net from "net"; 1491 | import * as stream from "stream"; 1492 | 1493 | var CLIENT_RENEG_LIMIT: number; 1494 | var CLIENT_RENEG_WINDOW: number; 1495 | 1496 | export interface TlsOptions { 1497 | pfx?: any; //string or buffer 1498 | key?: any; //string or buffer 1499 | passphrase?: string; 1500 | cert?: any; 1501 | ca?: any; //string or buffer 1502 | crl?: any; //string or string array 1503 | ciphers?: string; 1504 | honorCipherOrder?: any; 1505 | requestCert?: boolean; 1506 | rejectUnauthorized?: boolean; 1507 | NPNProtocols?: any; //array or Buffer; 1508 | SNICallback?: (servername: string) => any; 1509 | } 1510 | 1511 | export interface ConnectionOptions { 1512 | host?: string; 1513 | port?: number; 1514 | socket?: net.Socket; 1515 | pfx?: any; //string | Buffer 1516 | key?: any; //string | Buffer 1517 | passphrase?: string; 1518 | cert?: any; //string | Buffer 1519 | ca?: any; //Array of string | Buffer 1520 | rejectUnauthorized?: boolean; 1521 | NPNProtocols?: any; //Array of string | Buffer 1522 | servername?: string; 1523 | } 1524 | 1525 | export interface Server extends net.Server { 1526 | // Extended base methods 1527 | listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server; 1528 | listen(path: string, listeningListener?: Function): Server; 1529 | listen(handle: any, listeningListener?: Function): Server; 1530 | 1531 | listen(port: number, host?: string, callback?: Function): Server; 1532 | close(): Server; 1533 | address(): { port: number; family: string; address: string; }; 1534 | addContext(hostName: string, credentials: { 1535 | key: string; 1536 | cert: string; 1537 | ca: string; 1538 | }): void; 1539 | maxConnections: number; 1540 | connections: number; 1541 | } 1542 | 1543 | export interface ClearTextStream extends stream.Duplex { 1544 | authorized: boolean; 1545 | authorizationError: Error; 1546 | getPeerCertificate(): any; 1547 | getCipher: { 1548 | name: string; 1549 | version: string; 1550 | }; 1551 | address: { 1552 | port: number; 1553 | family: string; 1554 | address: string; 1555 | }; 1556 | remoteAddress: string; 1557 | remotePort: number; 1558 | } 1559 | 1560 | export interface SecurePair { 1561 | encrypted: any; 1562 | cleartext: any; 1563 | } 1564 | 1565 | export interface SecureContextOptions { 1566 | pfx?: any; //string | buffer 1567 | key?: any; //string | buffer 1568 | passphrase?: string; 1569 | cert?: any; // string | buffer 1570 | ca?: any; // string | buffer 1571 | crl?: any; // string | string[] 1572 | ciphers?: string; 1573 | honorCipherOrder?: boolean; 1574 | } 1575 | 1576 | export interface SecureContext { 1577 | context: any; 1578 | } 1579 | 1580 | export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server; 1581 | export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream; 1582 | export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; 1583 | export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; 1584 | export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; 1585 | export function createSecureContext(details: SecureContextOptions): SecureContext; 1586 | } 1587 | 1588 | declare module "crypto" { 1589 | export interface CredentialDetails { 1590 | pfx: string; 1591 | key: string; 1592 | passphrase: string; 1593 | cert: string; 1594 | ca: any; //string | string array 1595 | crl: any; //string | string array 1596 | ciphers: string; 1597 | } 1598 | export interface Credentials { context?: any; } 1599 | export function createCredentials(details: CredentialDetails): Credentials; 1600 | export function createHash(algorithm: string): Hash; 1601 | export function createHmac(algorithm: string, key: string): Hmac; 1602 | export function createHmac(algorithm: string, key: Buffer): Hmac; 1603 | interface Hash { 1604 | update(data: any, input_encoding?: string): Hash; 1605 | digest(encoding: 'buffer'): Buffer; 1606 | digest(encoding: string): any; 1607 | digest(): Buffer; 1608 | } 1609 | interface Hmac { 1610 | update(data: any, input_encoding?: string): Hmac; 1611 | digest(encoding: 'buffer'): Buffer; 1612 | digest(encoding: string): any; 1613 | digest(): Buffer; 1614 | } 1615 | export function createCipher(algorithm: string, password: any): Cipher; 1616 | export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; 1617 | interface Cipher { 1618 | update(data: Buffer): Buffer; 1619 | update(data: string, input_encoding?: string, output_encoding?: string): string; 1620 | final(): Buffer; 1621 | final(output_encoding: string): string; 1622 | setAutoPadding(auto_padding: boolean): void; 1623 | } 1624 | export function createDecipher(algorithm: string, password: any): Decipher; 1625 | export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; 1626 | interface Decipher { 1627 | update(data: Buffer): Buffer; 1628 | update(data: string, input_encoding?: string, output_encoding?: string): string; 1629 | final(): Buffer; 1630 | final(output_encoding: string): string; 1631 | setAutoPadding(auto_padding: boolean): void; 1632 | } 1633 | export function createSign(algorithm: string): Signer; 1634 | interface Signer extends NodeJS.WritableStream { 1635 | update(data: any): void; 1636 | sign(private_key: string, output_format: string): string; 1637 | } 1638 | export function createVerify(algorith: string): Verify; 1639 | interface Verify extends NodeJS.WritableStream { 1640 | update(data: any): void; 1641 | verify(object: string, signature: string, signature_format?: string): boolean; 1642 | } 1643 | export function createDiffieHellman(prime_length: number): DiffieHellman; 1644 | export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; 1645 | interface DiffieHellman { 1646 | generateKeys(encoding?: string): string; 1647 | computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string; 1648 | getPrime(encoding?: string): string; 1649 | getGenerator(encoding: string): string; 1650 | getPublicKey(encoding?: string): string; 1651 | getPrivateKey(encoding?: string): string; 1652 | setPublicKey(public_key: string, encoding?: string): void; 1653 | setPrivateKey(public_key: string, encoding?: string): void; 1654 | } 1655 | export function getDiffieHellman(group_name: string): DiffieHellman; 1656 | export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; 1657 | export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; 1658 | export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; 1659 | export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number, digest: string) : Buffer; 1660 | export function randomBytes(size: number): Buffer; 1661 | export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; 1662 | export function pseudoRandomBytes(size: number): Buffer; 1663 | export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; 1664 | } 1665 | 1666 | declare module "stream" { 1667 | import * as events from "events"; 1668 | 1669 | export interface Stream extends events.EventEmitter { 1670 | pipe(destination: T, options?: { end?: boolean; }): T; 1671 | } 1672 | 1673 | export interface ReadableOptions { 1674 | highWaterMark?: number; 1675 | encoding?: string; 1676 | objectMode?: boolean; 1677 | } 1678 | 1679 | export class Readable extends events.EventEmitter implements NodeJS.ReadableStream { 1680 | readable: boolean; 1681 | constructor(opts?: ReadableOptions); 1682 | _read(size: number): void; 1683 | read(size?: number): any; 1684 | setEncoding(encoding: string): void; 1685 | pause(): void; 1686 | resume(): void; 1687 | pipe(destination: T, options?: { end?: boolean; }): T; 1688 | unpipe(destination?: T): void; 1689 | unshift(chunk: any): void; 1690 | wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; 1691 | push(chunk: any, encoding?: string): boolean; 1692 | } 1693 | 1694 | export interface WritableOptions { 1695 | highWaterMark?: number; 1696 | decodeStrings?: boolean; 1697 | } 1698 | 1699 | export class Writable extends events.EventEmitter implements NodeJS.WritableStream { 1700 | writable: boolean; 1701 | constructor(opts?: WritableOptions); 1702 | _write(chunk: any, encoding: string, callback: Function): void; 1703 | write(chunk: any, cb?: Function): boolean; 1704 | write(chunk: any, encoding?: string, cb?: Function): boolean; 1705 | end(): void; 1706 | end(chunk: any, cb?: Function): void; 1707 | end(chunk: any, encoding?: string, cb?: Function): void; 1708 | } 1709 | 1710 | export interface DuplexOptions extends ReadableOptions, WritableOptions { 1711 | allowHalfOpen?: boolean; 1712 | } 1713 | 1714 | // Note: Duplex extends both Readable and Writable. 1715 | export class Duplex extends Readable implements NodeJS.ReadWriteStream { 1716 | writable: boolean; 1717 | constructor(opts?: DuplexOptions); 1718 | _write(chunk: any, encoding: string, callback: Function): void; 1719 | write(chunk: any, cb?: Function): boolean; 1720 | write(chunk: any, encoding?: string, cb?: Function): boolean; 1721 | end(): void; 1722 | end(chunk: any, cb?: Function): void; 1723 | end(chunk: any, encoding?: string, cb?: Function): void; 1724 | } 1725 | 1726 | export interface TransformOptions extends ReadableOptions, WritableOptions {} 1727 | 1728 | // Note: Transform lacks the _read and _write methods of Readable/Writable. 1729 | export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream { 1730 | readable: boolean; 1731 | writable: boolean; 1732 | constructor(opts?: TransformOptions); 1733 | _transform(chunk: any, encoding: string, callback: Function): void; 1734 | _flush(callback: Function): void; 1735 | read(size?: number): any; 1736 | setEncoding(encoding: string): void; 1737 | pause(): void; 1738 | resume(): void; 1739 | pipe(destination: T, options?: { end?: boolean; }): T; 1740 | unpipe(destination?: T): void; 1741 | unshift(chunk: any): void; 1742 | wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; 1743 | push(chunk: any, encoding?: string): boolean; 1744 | write(chunk: any, cb?: Function): boolean; 1745 | write(chunk: any, encoding?: string, cb?: Function): boolean; 1746 | end(): void; 1747 | end(chunk: any, cb?: Function): void; 1748 | end(chunk: any, encoding?: string, cb?: Function): void; 1749 | } 1750 | 1751 | export class PassThrough extends Transform {} 1752 | } 1753 | 1754 | declare module "util" { 1755 | export interface InspectOptions { 1756 | showHidden?: boolean; 1757 | depth?: number; 1758 | colors?: boolean; 1759 | customInspect?: boolean; 1760 | } 1761 | 1762 | export function format(format: any, ...param: any[]): string; 1763 | export function debug(string: string): void; 1764 | export function error(...param: any[]): void; 1765 | export function puts(...param: any[]): void; 1766 | export function print(...param: any[]): void; 1767 | export function log(string: string): void; 1768 | export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string; 1769 | export function inspect(object: any, options: InspectOptions): string; 1770 | export function isArray(object: any): boolean; 1771 | export function isRegExp(object: any): boolean; 1772 | export function isDate(object: any): boolean; 1773 | export function isError(object: any): boolean; 1774 | export function inherits(constructor: any, superConstructor: any): void; 1775 | } 1776 | 1777 | declare module "assert" { 1778 | function internal (value: any, message?: string): void; 1779 | module internal { 1780 | export class AssertionError implements Error { 1781 | name: string; 1782 | message: string; 1783 | actual: any; 1784 | expected: any; 1785 | operator: string; 1786 | generatedMessage: boolean; 1787 | 1788 | constructor(options?: {message?: string; actual?: any; expected?: any; 1789 | operator?: string; stackStartFunction?: Function}); 1790 | } 1791 | 1792 | export function fail(actual?: any, expected?: any, message?: string, operator?: string): void; 1793 | export function ok(value: any, message?: string): void; 1794 | export function equal(actual: any, expected: any, message?: string): void; 1795 | export function notEqual(actual: any, expected: any, message?: string): void; 1796 | export function deepEqual(actual: any, expected: any, message?: string): void; 1797 | export function notDeepEqual(acutal: any, expected: any, message?: string): void; 1798 | export function strictEqual(actual: any, expected: any, message?: string): void; 1799 | export function notStrictEqual(actual: any, expected: any, message?: string): void; 1800 | export var throws: { 1801 | (block: Function, message?: string): void; 1802 | (block: Function, error: Function, message?: string): void; 1803 | (block: Function, error: RegExp, message?: string): void; 1804 | (block: Function, error: (err: any) => boolean, message?: string): void; 1805 | }; 1806 | 1807 | export var doesNotThrow: { 1808 | (block: Function, message?: string): void; 1809 | (block: Function, error: Function, message?: string): void; 1810 | (block: Function, error: RegExp, message?: string): void; 1811 | (block: Function, error: (err: any) => boolean, message?: string): void; 1812 | }; 1813 | 1814 | export function ifError(value: any): void; 1815 | } 1816 | 1817 | export = internal; 1818 | } 1819 | 1820 | declare module "tty" { 1821 | import * as net from "net"; 1822 | 1823 | export function isatty(fd: number): boolean; 1824 | export interface ReadStream extends net.Socket { 1825 | isRaw: boolean; 1826 | setRawMode(mode: boolean): void; 1827 | } 1828 | export interface WriteStream extends net.Socket { 1829 | columns: number; 1830 | rows: number; 1831 | } 1832 | } 1833 | 1834 | declare module "domain" { 1835 | import * as events from "events"; 1836 | 1837 | export class Domain extends events.EventEmitter { 1838 | run(fn: Function): void; 1839 | add(emitter: events.EventEmitter): void; 1840 | remove(emitter: events.EventEmitter): void; 1841 | bind(cb: (err: Error, data: any) => any): any; 1842 | intercept(cb: (data: any) => any): any; 1843 | dispose(): void; 1844 | 1845 | addListener(event: string, listener: Function): Domain; 1846 | on(event: string, listener: Function): Domain; 1847 | once(event: string, listener: Function): Domain; 1848 | removeListener(event: string, listener: Function): Domain; 1849 | removeAllListeners(event?: string): Domain; 1850 | } 1851 | 1852 | export function create(): Domain; 1853 | } 1854 | 1855 | declare module "constants" { 1856 | export var E2BIG: number; 1857 | export var EACCES: number; 1858 | export var EADDRINUSE: number; 1859 | export var EADDRNOTAVAIL: number; 1860 | export var EAFNOSUPPORT: number; 1861 | export var EAGAIN: number; 1862 | export var EALREADY: number; 1863 | export var EBADF: number; 1864 | export var EBADMSG: number; 1865 | export var EBUSY: number; 1866 | export var ECANCELED: number; 1867 | export var ECHILD: number; 1868 | export var ECONNABORTED: number; 1869 | export var ECONNREFUSED: number; 1870 | export var ECONNRESET: number; 1871 | export var EDEADLK: number; 1872 | export var EDESTADDRREQ: number; 1873 | export var EDOM: number; 1874 | export var EEXIST: number; 1875 | export var EFAULT: number; 1876 | export var EFBIG: number; 1877 | export var EHOSTUNREACH: number; 1878 | export var EIDRM: number; 1879 | export var EILSEQ: number; 1880 | export var EINPROGRESS: number; 1881 | export var EINTR: number; 1882 | export var EINVAL: number; 1883 | export var EIO: number; 1884 | export var EISCONN: number; 1885 | export var EISDIR: number; 1886 | export var ELOOP: number; 1887 | export var EMFILE: number; 1888 | export var EMLINK: number; 1889 | export var EMSGSIZE: number; 1890 | export var ENAMETOOLONG: number; 1891 | export var ENETDOWN: number; 1892 | export var ENETRESET: number; 1893 | export var ENETUNREACH: number; 1894 | export var ENFILE: number; 1895 | export var ENOBUFS: number; 1896 | export var ENODATA: number; 1897 | export var ENODEV: number; 1898 | export var ENOENT: number; 1899 | export var ENOEXEC: number; 1900 | export var ENOLCK: number; 1901 | export var ENOLINK: number; 1902 | export var ENOMEM: number; 1903 | export var ENOMSG: number; 1904 | export var ENOPROTOOPT: number; 1905 | export var ENOSPC: number; 1906 | export var ENOSR: number; 1907 | export var ENOSTR: number; 1908 | export var ENOSYS: number; 1909 | export var ENOTCONN: number; 1910 | export var ENOTDIR: number; 1911 | export var ENOTEMPTY: number; 1912 | export var ENOTSOCK: number; 1913 | export var ENOTSUP: number; 1914 | export var ENOTTY: number; 1915 | export var ENXIO: number; 1916 | export var EOPNOTSUPP: number; 1917 | export var EOVERFLOW: number; 1918 | export var EPERM: number; 1919 | export var EPIPE: number; 1920 | export var EPROTO: number; 1921 | export var EPROTONOSUPPORT: number; 1922 | export var EPROTOTYPE: number; 1923 | export var ERANGE: number; 1924 | export var EROFS: number; 1925 | export var ESPIPE: number; 1926 | export var ESRCH: number; 1927 | export var ETIME: number; 1928 | export var ETIMEDOUT: number; 1929 | export var ETXTBSY: number; 1930 | export var EWOULDBLOCK: number; 1931 | export var EXDEV: number; 1932 | export var WSAEINTR: number; 1933 | export var WSAEBADF: number; 1934 | export var WSAEACCES: number; 1935 | export var WSAEFAULT: number; 1936 | export var WSAEINVAL: number; 1937 | export var WSAEMFILE: number; 1938 | export var WSAEWOULDBLOCK: number; 1939 | export var WSAEINPROGRESS: number; 1940 | export var WSAEALREADY: number; 1941 | export var WSAENOTSOCK: number; 1942 | export var WSAEDESTADDRREQ: number; 1943 | export var WSAEMSGSIZE: number; 1944 | export var WSAEPROTOTYPE: number; 1945 | export var WSAENOPROTOOPT: number; 1946 | export var WSAEPROTONOSUPPORT: number; 1947 | export var WSAESOCKTNOSUPPORT: number; 1948 | export var WSAEOPNOTSUPP: number; 1949 | export var WSAEPFNOSUPPORT: number; 1950 | export var WSAEAFNOSUPPORT: number; 1951 | export var WSAEADDRINUSE: number; 1952 | export var WSAEADDRNOTAVAIL: number; 1953 | export var WSAENETDOWN: number; 1954 | export var WSAENETUNREACH: number; 1955 | export var WSAENETRESET: number; 1956 | export var WSAECONNABORTED: number; 1957 | export var WSAECONNRESET: number; 1958 | export var WSAENOBUFS: number; 1959 | export var WSAEISCONN: number; 1960 | export var WSAENOTCONN: number; 1961 | export var WSAESHUTDOWN: number; 1962 | export var WSAETOOMANYREFS: number; 1963 | export var WSAETIMEDOUT: number; 1964 | export var WSAECONNREFUSED: number; 1965 | export var WSAELOOP: number; 1966 | export var WSAENAMETOOLONG: number; 1967 | export var WSAEHOSTDOWN: number; 1968 | export var WSAEHOSTUNREACH: number; 1969 | export var WSAENOTEMPTY: number; 1970 | export var WSAEPROCLIM: number; 1971 | export var WSAEUSERS: number; 1972 | export var WSAEDQUOT: number; 1973 | export var WSAESTALE: number; 1974 | export var WSAEREMOTE: number; 1975 | export var WSASYSNOTREADY: number; 1976 | export var WSAVERNOTSUPPORTED: number; 1977 | export var WSANOTINITIALISED: number; 1978 | export var WSAEDISCON: number; 1979 | export var WSAENOMORE: number; 1980 | export var WSAECANCELLED: number; 1981 | export var WSAEINVALIDPROCTABLE: number; 1982 | export var WSAEINVALIDPROVIDER: number; 1983 | export var WSAEPROVIDERFAILEDINIT: number; 1984 | export var WSASYSCALLFAILURE: number; 1985 | export var WSASERVICE_NOT_FOUND: number; 1986 | export var WSATYPE_NOT_FOUND: number; 1987 | export var WSA_E_NO_MORE: number; 1988 | export var WSA_E_CANCELLED: number; 1989 | export var WSAEREFUSED: number; 1990 | export var SIGHUP: number; 1991 | export var SIGINT: number; 1992 | export var SIGILL: number; 1993 | export var SIGABRT: number; 1994 | export var SIGFPE: number; 1995 | export var SIGKILL: number; 1996 | export var SIGSEGV: number; 1997 | export var SIGTERM: number; 1998 | export var SIGBREAK: number; 1999 | export var SIGWINCH: number; 2000 | export var SSL_OP_ALL: number; 2001 | export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; 2002 | export var SSL_OP_CIPHER_SERVER_PREFERENCE: number; 2003 | export var SSL_OP_CISCO_ANYCONNECT: number; 2004 | export var SSL_OP_COOKIE_EXCHANGE: number; 2005 | export var SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; 2006 | export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; 2007 | export var SSL_OP_EPHEMERAL_RSA: number; 2008 | export var SSL_OP_LEGACY_SERVER_CONNECT: number; 2009 | export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; 2010 | export var SSL_OP_MICROSOFT_SESS_ID_BUG: number; 2011 | export var SSL_OP_MSIE_SSLV2_RSA_PADDING: number; 2012 | export var SSL_OP_NETSCAPE_CA_DN_BUG: number; 2013 | export var SSL_OP_NETSCAPE_CHALLENGE_BUG: number; 2014 | export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; 2015 | export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; 2016 | export var SSL_OP_NO_COMPRESSION: number; 2017 | export var SSL_OP_NO_QUERY_MTU: number; 2018 | export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; 2019 | export var SSL_OP_NO_SSLv2: number; 2020 | export var SSL_OP_NO_SSLv3: number; 2021 | export var SSL_OP_NO_TICKET: number; 2022 | export var SSL_OP_NO_TLSv1: number; 2023 | export var SSL_OP_NO_TLSv1_1: number; 2024 | export var SSL_OP_NO_TLSv1_2: number; 2025 | export var SSL_OP_PKCS1_CHECK_1: number; 2026 | export var SSL_OP_PKCS1_CHECK_2: number; 2027 | export var SSL_OP_SINGLE_DH_USE: number; 2028 | export var SSL_OP_SINGLE_ECDH_USE: number; 2029 | export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; 2030 | export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; 2031 | export var SSL_OP_TLS_BLOCK_PADDING_BUG: number; 2032 | export var SSL_OP_TLS_D5_BUG: number; 2033 | export var SSL_OP_TLS_ROLLBACK_BUG: number; 2034 | export var ENGINE_METHOD_DSA: number; 2035 | export var ENGINE_METHOD_DH: number; 2036 | export var ENGINE_METHOD_RAND: number; 2037 | export var ENGINE_METHOD_ECDH: number; 2038 | export var ENGINE_METHOD_ECDSA: number; 2039 | export var ENGINE_METHOD_CIPHERS: number; 2040 | export var ENGINE_METHOD_DIGESTS: number; 2041 | export var ENGINE_METHOD_STORE: number; 2042 | export var ENGINE_METHOD_PKEY_METHS: number; 2043 | export var ENGINE_METHOD_PKEY_ASN1_METHS: number; 2044 | export var ENGINE_METHOD_ALL: number; 2045 | export var ENGINE_METHOD_NONE: number; 2046 | export var DH_CHECK_P_NOT_SAFE_PRIME: number; 2047 | export var DH_CHECK_P_NOT_PRIME: number; 2048 | export var DH_UNABLE_TO_CHECK_GENERATOR: number; 2049 | export var DH_NOT_SUITABLE_GENERATOR: number; 2050 | export var NPN_ENABLED: number; 2051 | export var RSA_PKCS1_PADDING: number; 2052 | export var RSA_SSLV23_PADDING: number; 2053 | export var RSA_NO_PADDING: number; 2054 | export var RSA_PKCS1_OAEP_PADDING: number; 2055 | export var RSA_X931_PADDING: number; 2056 | export var RSA_PKCS1_PSS_PADDING: number; 2057 | export var POINT_CONVERSION_COMPRESSED: number; 2058 | export var POINT_CONVERSION_UNCOMPRESSED: number; 2059 | export var POINT_CONVERSION_HYBRID: number; 2060 | export var O_RDONLY: number; 2061 | export var O_WRONLY: number; 2062 | export var O_RDWR: number; 2063 | export var S_IFMT: number; 2064 | export var S_IFREG: number; 2065 | export var S_IFDIR: number; 2066 | export var S_IFCHR: number; 2067 | export var S_IFLNK: number; 2068 | export var O_CREAT: number; 2069 | export var O_EXCL: number; 2070 | export var O_TRUNC: number; 2071 | export var O_APPEND: number; 2072 | export var F_OK: number; 2073 | export var R_OK: number; 2074 | export var W_OK: number; 2075 | export var X_OK: number; 2076 | export var UV_UDP_REUSEADDR: number; 2077 | } 2078 | -------------------------------------------------------------------------------- /jscs-server/src/typings/promise.d.ts: -------------------------------------------------------------------------------- 1 | /*! ***************************************************************************** 2 | Copyright (c) Microsoft Corporation. All rights reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | this file except in compliance with the License. You may obtain a copy of the 5 | License at http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 8 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 9 | WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 10 | MERCHANTABLITY OR NON-INFRINGEMENT. 11 | 12 | See the Apache Version 2.0 License for specific language governing permissions 13 | and limitations under the License. 14 | ***************************************************************************** */ 15 | 16 | /** 17 | * The Thenable (E.g. PromiseLike) and Promise declarions are taken from TypeScript's 18 | * lib.core.es6.d.ts file. See above Copyright notice. 19 | */ 20 | 21 | /** 22 | * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise, 23 | * and others. This API makes no assumption about what promise libary is being used which 24 | * enables reusing existing code without migrating to a specific promise implementation. Still, 25 | * we recommand the use of native promises which are available in VS Code. 26 | */ 27 | interface Thenable { 28 | /** 29 | * Attaches callbacks for the resolution and/or rejection of the Promise. 30 | * @param onfulfilled The callback to execute when the Promise is resolved. 31 | * @param onrejected The callback to execute when the Promise is rejected. 32 | * @returns A Promise for the completion of which ever callback is executed. 33 | */ 34 | then(onfulfilled?: (value: R) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Thenable; 35 | then(onfulfilled?: (value: R) => TResult | Thenable, onrejected?: (reason: any) => void): Thenable; 36 | } 37 | 38 | /** 39 | * Represents the completion of an asynchronous operation 40 | */ 41 | interface Promise extends Thenable { 42 | /** 43 | * Attaches callbacks for the resolution and/or rejection of the Promise. 44 | * @param onfulfilled The callback to execute when the Promise is resolved. 45 | * @param onrejected The callback to execute when the Promise is rejected. 46 | * @returns A Promise for the completion of which ever callback is executed. 47 | */ 48 | then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Promise; 49 | then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => void): Promise; 50 | 51 | /** 52 | * Attaches a callback for only the rejection of the Promise. 53 | * @param onrejected The callback to execute when the Promise is rejected. 54 | * @returns A Promise for the completion of the callback. 55 | */ 56 | catch(onrejected?: (reason: any) => T | Thenable): Promise; 57 | } 58 | 59 | interface PromiseConstructor { 60 | /** 61 | * Creates a new Promise. 62 | * @param executor A callback used to initialize the promise. This callback is passed two arguments: 63 | * a resolve callback used resolve the promise with a value or the result of another promise, 64 | * and a reject callback used to reject the promise with a provided reason or error. 65 | */ 66 | new (executor: (resolve: (value?: T | Thenable) => void, reject: (reason?: any) => void) => void): Promise; 67 | 68 | /** 69 | * Creates a Promise that is resolved with an array of results when all of the provided Promises 70 | * resolve, or rejected when any Promise is rejected. 71 | * @param values An array of Promises. 72 | * @returns A new Promise. 73 | */ 74 | all(values: Array>): Promise; 75 | 76 | /** 77 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved 78 | * or rejected. 79 | * @param values An array of Promises. 80 | * @returns A new Promise. 81 | */ 82 | race(values: Array>): Promise; 83 | 84 | /** 85 | * Creates a new rejected promise for the provided reason. 86 | * @param reason The reason the promise was rejected. 87 | * @returns A new rejected Promise. 88 | */ 89 | reject(reason: any): Promise; 90 | 91 | /** 92 | * Creates a new rejected promise for the provided reason. 93 | * @param reason The reason the promise was rejected. 94 | * @returns A new rejected Promise. 95 | */ 96 | reject(reason: any): Promise; 97 | 98 | /** 99 | * Creates a new resolved promise for the provided value. 100 | * @param value A promise. 101 | * @returns A promise whose internal state matches the provided promise. 102 | */ 103 | resolve(value: T | Thenable): Promise; 104 | 105 | /** 106 | * Creates a new resolved promise . 107 | * @returns A resolved promise. 108 | */ 109 | resolve(): Promise; 110 | } 111 | 112 | declare var Promise: PromiseConstructor; -------------------------------------------------------------------------------- /jscs/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], 11 | "stopOnEntry": false, 12 | "sourceMaps": true, 13 | "outDir": "${workspaceRoot}/out", 14 | "preLaunchTask": "npm" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /jscs/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true 8 | }, 9 | "editor.insertSpaces": false, 10 | "editor.tabSize": 4, 11 | "tslint.enable": false 12 | } -------------------------------------------------------------------------------- /jscs/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // Available variables which can be used inside of strings. 2 | // ${workspaceRoot}: the root folder of the team 3 | // ${file}: the current opened file 4 | // ${fileBasename}: the current opened file's basename 5 | // ${fileDirname}: the current opened file's dirname 6 | // ${fileExtname}: the current opened file's extension 7 | // ${cwd}: the current working directory of the spawned process 8 | 9 | // A task runner that calls a custom npm script that compiles the extension. 10 | { 11 | "version": "0.1.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "isShellCommand": true, 18 | 19 | // show the output window only if unrecognized errors occur. 20 | "showOutput": "silent", 21 | 22 | // we run the custom script "compile" as defined in package.json 23 | "args": ["run", "compile"], 24 | 25 | // The tsc compiler is started in watching mode 26 | "isWatching": true, 27 | 28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 29 | "problemMatcher": "$tsc-watch" 30 | } -------------------------------------------------------------------------------- /jscs/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | typings/** 3 | **/*.ts 4 | **/*.map 5 | .gitignore 6 | tsconfig.json 7 | vsc-extension-quickstart.md 8 | -------------------------------------------------------------------------------- /jscs/JSCS_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/vscode-jscs/052c2e19cd02b33150eefe4ec5a7565595105c5e/jscs/JSCS_icon.png -------------------------------------------------------------------------------- /jscs/JSCS_icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 13 | 14 | 15 | 16 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /jscs/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 8 | files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, 9 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 16 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 17 | OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /jscs/README.md: -------------------------------------------------------------------------------- 1 | # JSCS Support for Visual Studio Code 2 | 3 | [JSCS](https://jscs-dev.github.io) support for Visual Studio Code. 4 | 5 | > **❗IMPORTANT**: JSCS [is deprecated and has merged with ESLint](https://medium.com/@markelog/jscs-end-of-the-line-bc9bf0b3fdb2). 6 | > 7 | > Please migrate your projects to ESLint and use the VS Code [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint). 8 | 9 | # Installation and Usage 10 | 11 | The JSCS Linter is available in the Visual Studio Code Gallery. To install, press `F1` and 12 | select `Extensions: Install Extensions` and then search for and select `JSCS Linting`. 13 | 14 | Install JSCS in your workspace (or globally using the `-g` switch). 15 | 16 | ``` bash 17 | # install locally to the workspace 18 | npm install jscs 19 | ``` 20 | 21 | Once installed, the JSCS Linter will automatically analyze your JavaScript files and return style warnings 22 | based on the rules you define in a `.jscsrc` file or in your settings. 23 | 24 | ## Configuring the JSCS Linter 25 | 26 | The best way to configure how the linter flags issues in your code is to create a `.jscsrc` file in the 27 | root of your workspace. The VS Code JSCS Linter will look for this file first and if no `.jscsrc` file is found 28 | it will look into your custom [Settings](https://code.visualstudio.com/docs/customization/userandworkspace). 29 | 30 | Here are the available settings options: 31 | 32 | Enable or disable the JSCS Linter for JavaScript files in this workspace. 33 | ``` json 34 | "jscs.enable": boolean 35 | ``` 36 | 37 | The JSCS preset to use, possible values: `airbnb`, `crockford`, `google`, `grunt`, `idiomatic`, `jquery`, `mdcs`, `node-style-guide`, `wikimedia`, `wordpress`, `yandex`. 38 | ``` json 39 | "jscs.preset": string 40 | ``` 41 | 42 | Disable the JSCS Linter if no `.jscsrc` configuration file is found, default is `false`. 43 | ``` json 44 | "jscs.disableIfNoConfig": boolean 45 | ``` 46 | 47 | Set [JSCS configuration rules](http://jscs.info/rules) in your settings file directly. 48 | ``` json 49 | "jscs.configuration": object 50 | ``` 51 | 52 | # Development 53 | The JSCS Linter is a great way to learn how to create extensions for VS Code. 54 | We also love enhancements and bug fixes! To get started, [clone the repo](https://github.com/microsoft/vscode-jscs) 55 | and check out the [README.md](https://github.com/Microsoft/vscode-jscs/blob/master/README.md) 56 | for more details 57 | 58 | Enjoy! 59 | 60 | # License 61 | [MIT](LICENSE) -------------------------------------------------------------------------------- /jscs/extension.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { window, workspace, commands, Disposable, ExtensionContext } from 'vscode'; 3 | import { LanguageClient, LanguageClientOptions, SettingMonitor, RequestType } from 'vscode-languageclient'; 4 | 5 | 6 | export function activate(context: ExtensionContext) { 7 | 8 | // We need to go one level up since an extension compile the js code into 9 | // the output folder. 10 | 11 | let serverModule = path.join(__dirname, '..', 'server', 'server.js'); 12 | 13 | // TIP! change --debug to --debug-brk to debug initialization code in the server 14 | // F5 the extension and then F5 (Attach) the server instance 15 | let debugOptions = { execArgv: ["--nolazy", "--debug=6004"] }; 16 | 17 | let serverOptions = { 18 | run: { module: serverModule }, 19 | debug: { module: serverModule, options: debugOptions} 20 | }; 21 | 22 | let clientOptions: LanguageClientOptions = { 23 | documentSelector: ['javascript', 'javascriptreact'], 24 | synchronize: { 25 | configurationSection: 'jscs', 26 | fileEvents: workspace.createFileSystemWatcher('**/.jscsrc') 27 | } 28 | } 29 | 30 | let client = new LanguageClient('JSCS', serverOptions, clientOptions); 31 | 32 | context.subscriptions.push(new SettingMonitor(client, 'jscs.enable').start()); 33 | 34 | // commands.registerCommand('jscs.fixFile', () => { 35 | // client.sendRequest(MyCommandRequest.type, { command: "jscs-quickfix"}).then((result) => { 36 | // window.showInformationMessage(result.message); 37 | // }); 38 | // }); 39 | } 40 | -------------------------------------------------------------------------------- /jscs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jscs", 3 | "version": "0.1.11", 4 | "author": "Microsoft Corporation", 5 | "publisher": "ms-vscode", 6 | "license": "SEE LICENSE IN LICENSE.md", 7 | "displayName": "JSCS Linting (deprecated)", 8 | "description": "A JSCS Linter for Visual Studio Code", 9 | "icon": "JSCS_icon.png", 10 | "galleryBanner": { 11 | "color": "#37699A", 12 | "theme": "dark" 13 | }, 14 | "homepage": "https://github.com/Microsoft/vscode-jscs/blob/master/README.md", 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/Microsoft/vscode-jscs.git" 18 | }, 19 | "bugs": { 20 | "url": "https://github.com/Microsoft/vscode-jscs/issues" 21 | }, 22 | "categories": [ 23 | "Linters" 24 | ], 25 | "engines": { 26 | "vscode": "^0.10.7" 27 | }, 28 | "activationEvents": [ 29 | "onLanguage:javascript" 30 | ], 31 | "main": "./out/extension", 32 | "contributes": { 33 | "configuration": { 34 | "type": "object", 35 | "title": "JSCS configuration options", 36 | "properties": { 37 | "jscs.enable": { 38 | "type": "boolean", 39 | "default": true, 40 | "description": "Control whether JSCS is enabled for JavaScript files or not." 41 | }, 42 | "jscs.preset": { 43 | "type": "string", 44 | "default": "", 45 | "description": "The JSCS preset to use. Possible values: \"airbnb\", \"crockford\", \"google\", \"grunt\", \"idiomatic\", \"jquery\", \"mdcs\", \"node-style-guide\", \"wikimedia\", \"wordpress\", \"yandex\"" 46 | }, 47 | "jscs.disableIfNoConfig": { 48 | "type": "boolean", 49 | "default": false, 50 | "description": "Disable JSCS if no configuration file found." 51 | }, 52 | "jscs.configuration": { 53 | "type": "object", 54 | "default": {}, 55 | "description": "A JSCS configuration object" 56 | } 57 | } 58 | }, 59 | "jsonValidation": [ 60 | { 61 | "fileMatch": ".jscsrc", 62 | "url": "http://json.schemastore.org/jscsrc" 63 | } 64 | ] 65 | }, 66 | "scripts": { 67 | "postinstall": "node ./node_modules/vscode/bin/install", 68 | "vscode:prepublish": "cd ../jscs-server && npm run compile && cd ../jscs && tsc -p ./", 69 | "compile": "tsc -p ./", 70 | "watch": "tsc -watch -p ./", 71 | "update-vscode": "node ./node_modules/vscode/bin/install" 72 | }, 73 | "devDependencies": { 74 | "typescript": "^4.0.5", 75 | "vscode": "^0.11.x" 76 | }, 77 | "dependencies": { 78 | "vscode-languageclient": "^2.0.0" 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /jscs/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jscs-server", 3 | "version": "0.1.4", 4 | "description": "JSCS Server", 5 | "author": "Microsoft Corporation", 6 | "license": "MIT", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/Microsoft/vscode-jscs.git" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/Microsoft/vscode-jscs/issues" 13 | }, 14 | "engines": { 15 | "node": "*" 16 | }, 17 | "private": true, 18 | "dependencies": { 19 | "vscode-languageserver": "^2.0.0" 20 | }, 21 | "devDependencies": { 22 | "copyfiles": "^0.2.1", 23 | "typescript": "^1.8.10" 24 | }, 25 | "scripts": { 26 | "compile": "installServerIntoExtension ../jscs ./package.json ./src/tsconfig.json && tsc -p ./src", 27 | "watch": "installServerIntoExtension ../jscs ./package.json ./src/tsconfig.json && tsc --watch -p ./src" 28 | } 29 | } -------------------------------------------------------------------------------- /jscs/server/server.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | 'use strict'; 5 | var server = require('vscode-languageserver'); 6 | var configCache = { 7 | filePath: null, 8 | configuration: null 9 | }; 10 | var settings = null; 11 | var options = null; 12 | var linter = null; 13 | var configLib = null; 14 | var connection = server.createConnection(process.stdin, process.stdout); 15 | var documents = new server.TextDocuments(); 16 | function flushConfigCache() { 17 | configCache = { 18 | filePath: null, 19 | configuration: null 20 | }; 21 | } 22 | function validateSingle(document) { 23 | try { 24 | validate(document); 25 | } 26 | catch (err) { 27 | connection.window.showErrorMessage(getMessage(err, document)); 28 | } 29 | } 30 | function validateMany(documents) { 31 | var tracker = new server.ErrorMessageTracker(); 32 | documents.forEach(function (document) { 33 | try { 34 | validate(document); 35 | } 36 | catch (err) { 37 | tracker.add(getMessage(err, document)); 38 | } 39 | }); 40 | tracker.sendErrors(connection); 41 | } 42 | function getConfiguration(filePath) { 43 | if (configCache.configuration && configCache.filePath === filePath) { 44 | return configCache.configuration; 45 | } 46 | configCache = { 47 | filePath: filePath, 48 | configuration: configLib.load(false, filePath) 49 | }; 50 | return configCache.configuration; 51 | } 52 | function validate(document) { 53 | try { 54 | var checker = new linter(); 55 | var fileContents = document.getText(); 56 | var uri = document.uri; 57 | var fsPath = server.Files.uriToFilePath(uri); 58 | var config = getConfiguration(fsPath); 59 | if (!config && settings.jscs.disableIfNoConfig) { 60 | return; 61 | } 62 | if (settings.jscs.configuration) { 63 | options = settings.jscs.configuration; 64 | } 65 | else if (settings.jscs.preset) { 66 | options = { 67 | "preset": settings.jscs.preset 68 | }; 69 | } 70 | else { 71 | // TODO provide some sort of warning that there is no config 72 | // use jquery by default 73 | options = { "preset": "jquery" }; 74 | } 75 | // configure jscs module 76 | checker.registerDefaultRules(); 77 | checker.configure(config || options); 78 | var diagnostics_1 = []; 79 | var results = checker.checkString(fileContents); 80 | var errors = results.getErrorList(); 81 | // test for checker.maxErrorsExceeded(); 82 | if (errors.length > 0) { 83 | errors.forEach(function (e) { 84 | diagnostics_1.push(makeDiagnostic(e)); 85 | }); 86 | } 87 | //return connection.sendDiagnostics({ uri, diagnostics }); 88 | connection.sendDiagnostics({ uri: uri, diagnostics: diagnostics_1 }); 89 | } 90 | catch (err) { 91 | var message = null; 92 | if (typeof err.message === 'string' || err.message instanceof String) { 93 | message = err.message; 94 | throw new Error(message); 95 | } 96 | throw err; 97 | } 98 | } 99 | function makeDiagnostic(e) { 100 | var res; 101 | res = { 102 | message: e.message, 103 | // all JSCS errors are Warnings in our world 104 | severity: 2 /* Warning */, 105 | // start alone will select word if in one 106 | range: { 107 | start: { 108 | line: e.line - 1, 109 | character: e.column 110 | }, 111 | end: { 112 | line: e.line - 1, 113 | character: Number.MAX_VALUE 114 | } 115 | }, 116 | code: e.rule, 117 | source: 'JSCS' 118 | }; 119 | return res; 120 | } 121 | function getMessage(err, document) { 122 | var result = null; 123 | if (typeof err.message === 'string' || err.message instanceof String) { 124 | result = err.message; 125 | result = result.replace(/\r?\n/g, ' '); 126 | } 127 | else { 128 | result = "An unknown error occured while validating file: " + server.Files.uriToFilePath(document.uri); 129 | } 130 | return result; 131 | } 132 | // The documents manager listen for text document create, change 133 | // and close on the connection 134 | documents.listen(connection); 135 | // A text document has changed. Validate the document. 136 | documents.onDidChangeContent(function (event) { 137 | validateSingle(event.document); 138 | }); 139 | connection.onInitialize(function (params) { 140 | var rootPath = params.rootPath; 141 | return server.Files.resolveModule(rootPath, 'jscs').then(function (value) { 142 | linter = value; 143 | return server.Files.resolveModule(rootPath, 'jscs/lib/cli-config').then(function (value) { 144 | configLib = value; 145 | return { capabilities: { textDocumentSync: documents.syncKind } }; 146 | }, function (error) { 147 | return Promise.reject(new server.ResponseError(99, 'Failed to load jscs/lib/cli-config library. Please install jscs in your workspace folder using \'npm install jscs\' and then press Retry.', { retry: true })); 148 | }); 149 | }, function (error) { 150 | return Promise.reject(new server.ResponseError(99, 'Failed to load jscs library. Please install jscs in your workspace folder using \'npm install jscs\' and then press Retry.', { retry: true })); 151 | }); 152 | }); 153 | connection.onDidChangeConfiguration(function (params) { 154 | flushConfigCache(); 155 | settings = params.settings; 156 | validateMany(documents.all()); 157 | }); 158 | connection.onDidChangeWatchedFiles(function (params) { 159 | flushConfigCache(); 160 | validateMany(documents.all()); 161 | }); 162 | connection.listen(); 163 | //# sourceMappingURL=server.js.map -------------------------------------------------------------------------------- /jscs/server/server.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"server.js","sourceRoot":"","sources":["../../jscs-server/src/server.ts"],"names":[],"mappings":"AAAA;;4DAE4D;AAC5D,YAAY,CAAC;AAEb,IAAY,MAAM,WAAM,uBAAuB,CAAC,CAAA;AAyBhD,IAAI,WAAW,GAAG;IACjB,QAAQ,EAAU,IAAI;IACtB,aAAa,EAAO,IAAI;CACxB,CAAA;AAED,IAAI,QAAQ,GAAa,IAAI,CAAC;AAC9B,IAAI,OAAO,GAAO,IAAI,CAAC;AACvB,IAAI,MAAM,GAAQ,IAAI,CAAC;AACvB,IAAI,SAAS,GAAQ,IAAI,CAAC;AAC1B,IAAI,UAAU,GAAuB,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC5F,IAAI,SAAS,GAAyB,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;AAEjE;IACC,WAAW,GAAG;QACb,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;KACnB,CAAA;AACF,CAAC;AAED,wBAAwB,QAA6B;IACpD,IAAI,CAAC;QACJ,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAE;IAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACd,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/D,CAAC;AACF,CAAC;AAED,sBAAsB,SAAgC;IACrD,IAAI,OAAO,GAAG,IAAI,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAC/C,SAAS,CAAC,OAAO,CAAC,UAAA,QAAQ;QACzB,IAAI,CAAC;YACJ,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpB,CAAE;QAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;QACxC,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AAED,0BAA0B,QAAgB;IAEzC,EAAE,CAAC,CAAC,WAAW,CAAC,aAAa,IAAI,WAAW,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC;QACpE,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC;IAClC,CAAC;IAED,WAAW,GAAG;QACb,QAAQ,EAAE,QAAQ;QAClB,aAAa,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;KAC9C,CAAA;IAED,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC;AAClC,CAAC;AAED,kBAAkB,QAA6B;IAE9C,IAAI,CAAC;QAEJ,IAAI,OAAO,GAAG,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,YAAY,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtC,IAAI,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QACvB,IAAI,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAG7C,IAAI,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAEtC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;YAChD,MAAM,CAAC;QACR,CAAC;QAED,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACjC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;QACvC,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,OAAO,GAAG;gBACT,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;aAC9B,CAAC;QACH,CAAC;QAAC,IAAI,CAAC,CAAC;YACP,4DAA4D;YAC5D,wBAAwB;YACxB,OAAO,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAClC,CAAC;QAED,wBAAwB;QACxB,OAAO,CAAC,oBAAoB,EAAE,CAAC;QAC/B,OAAO,CAAC,SAAS,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC;QAErC,IAAI,aAAW,GAAwB,EAAE,CAAC;QAC1C,IAAI,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,MAAM,GAAgB,OAAO,CAAC,YAAY,EAAE,CAAC;QAEjD,wCAAwC;QAExC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YACvB,MAAM,CAAC,OAAO,CAAC,UAAC,CAAC;gBAChB,aAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,CAAC,CAAC,CAAA;QACH,CAAC;QAED,0DAA0D;QAC1D,UAAU,CAAC,eAAe,CAAC,EAAE,KAAA,GAAG,EAAE,aAAA,aAAW,EAAE,CAAC,CAAC;IAElD,CAAE;IAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACd,IAAI,OAAO,GAAW,IAAI,CAAC;QAC3B,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,YAAY,MAAM,CAAC,CAAC,CAAC;YACtE,OAAO,GAAW,GAAG,CAAC,OAAO,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;QACD,MAAM,GAAG,CAAC;IACX,CAAC;AACF,CAAC;AAED,wBAAwB,CAAY;IAEnC,IAAI,GAAsB,CAAC;IAE3B,GAAG,GAAG;QACL,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,4CAA4C;QAC5C,QAAQ,EAAE,eAAiC;QAC3C,yCAAyC;QACzC,KAAK,EAAE;YACN,KAAK,EAAE;gBACN,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;gBAChB,SAAS,EAAE,CAAC,CAAC,MAAM;aACnB;YACD,GAAG,EAAE;gBACJ,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;gBAChB,SAAS,EAAE,MAAM,CAAC,SAAS;aAC3B;SACD;QACD,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,MAAM,EAAE,MAAM;KACd,CAAC;IACF,MAAM,CAAC,GAAG,CAAC;AACZ,CAAC;AAED,oBAAoB,GAAQ,EAAE,QAA6B;IAC1D,IAAI,MAAM,GAAW,IAAI,CAAC;IAC1B,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,YAAY,MAAM,CAAC,CAAC,CAAC;QACtE,MAAM,GAAW,GAAG,CAAC,OAAO,CAAC;QAC7B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;IAAC,IAAI,CAAC,CAAC;QACP,MAAM,GAAG,qDAAmD,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAG,CAAC;IACxG,CAAC;IACD,MAAM,CAAC,MAAM,CAAC;AACf,CAAC;AAED,gEAAgE;AAChE,8BAA8B;AAC9B,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAE7B,sDAAsD;AACtD,SAAS,CAAC,kBAAkB,CAAC,UAAC,KAAK;IAClC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,CAAC,UAAC,MAAM;IAC9B,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAE/B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,UAAC,KAAK;QAC9D,MAAM,GAAG,KAAK,CAAC;QACf,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC,IAAI,CAAC,UAAC,KAAK;YAC7E,SAAS,GAAG,KAAK,CAAC;YAGlB,MAAM,CAAC,EAAE,YAAY,EAAE,EAAE,gBAAgB,EAAE,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;QACnE,CAAC,EAAE,UAAC,KAAK;YACR,MAAM,CAAC,OAAO,CAAC,MAAM,CACpB,IAAI,MAAM,CAAC,aAAa,CAAyB,EAAE,EAClD,2IAA2I,EAC3I,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC,EAAE,UAAC,KAAK;QACR,MAAM,CAAC,OAAO,CAAC,MAAM,CACpB,IAAI,MAAM,CAAC,aAAa,CAAyB,EAAE,EAClD,4HAA4H,EAC5H,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AAEJ,CAAC,CAAC,CAAA;AAEF,UAAU,CAAC,wBAAwB,CAAC,UAAC,MAAM;IAC1C,gBAAgB,EAAE,CAAC;IACnB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC3B,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,uBAAuB,CAAC,UAAC,MAAM;IACtC,gBAAgB,EAAE,CAAC;IACtB,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,MAAM,EAAE,CAAC"} -------------------------------------------------------------------------------- /jscs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES5", 5 | "outDir": "out", 6 | "noLib": true, 7 | "sourceMap": true 8 | }, 9 | "exclude": [ 10 | "node_modules", 11 | "server" 12 | ] 13 | } -------------------------------------------------------------------------------- /jscs/typings/vscode-typings.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /test/.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "esnext": true, 3 | "disallowSpacesInNamedFunctionExpression": { 4 | "beforeOpeningRoundBrace": true 5 | }, 6 | "disallowSpacesInFunctionExpression": { 7 | "beforeOpeningRoundBrace": true 8 | }, 9 | "disallowSpacesInAnonymousFunctionExpression": { 10 | "beforeOpeningRoundBrace": true 11 | }, 12 | "disallowSpacesInFunctionDeclaration": { 13 | "beforeOpeningRoundBrace": true 14 | }, 15 | "disallowEmptyBlocks": true, 16 | "disallowSpacesInCallExpression": true, 17 | "disallowSpacesInsideArrayBrackets": true, 18 | "disallowSpacesInsideParentheses": true, 19 | "disallowQuotedKeysInObjects": true, 20 | "disallowSpaceAfterObjectKeys": true, 21 | "disallowSpaceAfterPrefixUnaryOperators": true, 22 | "disallowSpaceBeforePostfixUnaryOperators": true, 23 | "disallowSpaceBeforeBinaryOperators": [ 24 | "," 25 | ], 26 | "disallowMixedSpacesAndTabs": true, 27 | "disallowTrailingWhitespace": true, 28 | "requireTrailingComma": { "ignoreSingleLine": true }, 29 | "requireSpaceAfterComma": true, 30 | "disallowYodaConditions": true, 31 | "disallowKeywords": [ "with" ], 32 | "disallowKeywordsOnNewLine": ["else"], 33 | "disallowMultipleLineBreaks": true, 34 | "disallowMultipleLineStrings": true, 35 | "disallowMultipleVarDecl": true, 36 | "disallowSpaceBeforeComma": true, 37 | "disallowSpaceBeforeSemicolon": true, 38 | "requireSpaceBeforeBlockStatements": true, 39 | "requireParenthesesAroundIIFE": true, 40 | "requireSpacesInConditionalExpression": true, 41 | "requireBlocksOnNewline": 1, 42 | "requireCommaBeforeLineBreak": true, 43 | "requireSpaceBeforeBinaryOperators": true, 44 | "requireSpaceAfterBinaryOperators": true, 45 | "requireCamelCaseOrUpperCaseIdentifiers": true, 46 | "requireLineFeedAtFileEnd": true, 47 | "requireCapitalizedConstructors": true, 48 | "requireDotNotation": true, 49 | "requireSpacesInForStatement": true, 50 | "requireSpaceBetweenArguments": true, 51 | "requireCurlyBraces": [ 52 | "do" 53 | ], 54 | "requireSpaceAfterKeywords": [ 55 | "if", 56 | "else", 57 | "for", 58 | "while", 59 | "do", 60 | "switch", 61 | "case", 62 | "return", 63 | "try", 64 | "catch", 65 | "typeof" 66 | ], 67 | "requirePaddingNewLinesBeforeLineComments": { 68 | "allExcept": "firstAfterCurly" 69 | }, 70 | "requirePaddingNewLinesAfterBlocks": true, 71 | "requireSemicolons": true, 72 | "safeContextKeyword": "_this", 73 | "validateLineBreaks": "LF", 74 | "validateQuoteMarks": "'", 75 | "validateIndentation": 2 76 | } -------------------------------------------------------------------------------- /test/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | 4 | "jscs.enable": true, 5 | "jscs.preset": "jquery", 6 | //"jscs.configuration": {}, 7 | "jscs.disableIfNoConfig": true 8 | } -------------------------------------------------------------------------------- /test/debug.log: -------------------------------------------------------------------------------- 1 | [0708/113351:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 2 | [0708/113351:ERROR:node_debugger.cc(86)] Cannot start debugger server 3 | [0708/113732:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 4 | [0708/113732:ERROR:node_debugger.cc(86)] Cannot start debugger server 5 | [0708/113759:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 6 | [0708/113759:ERROR:node_debugger.cc(86)] Cannot start debugger server 7 | [0708/114044:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 8 | [0708/114044:ERROR:node_debugger.cc(86)] Cannot start debugger server 9 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | 3 | console.log('sdfasdf '); 4 | } 5 | 6 | if (true) 7 | 8 | var x2 = 20; 9 | 10 | var x; 11 | 12 | 'use strict'; 13 | 14 | function bar(x) { }; 15 | 16 | function foo2() {} 17 | 18 | var Checker = require('jscs'); 19 | var checker = new Checker(); 20 | checker.registerDefaultRules(); 21 | var fs = require('fs'); 22 | checker.configure({ 23 | preset: 'airbnb', 24 | }); 25 | 26 | var file = fs.readFileSync('index.js', 'utf8'); 27 | var results = checker.checkString(file); 28 | var errors = results.getErrorList(); 29 | 30 | console.log(errors); 31 | -------------------------------------------------------------------------------- /test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jscstest", 3 | "version": "1.0.0", 4 | "description": "jscs test application", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "jscs" 11 | ], 12 | "author": "chrisdias", 13 | "license": "MIT", 14 | "dependencies": { 15 | "jscs": "^2.3.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/test.1.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | 'use strict'; 5 | /** 6 | * The shutdown command is send from the client to the worker. 7 | * It is send once when the client descides to shutdown the 8 | * worker. The only event that is send after a shudown request 9 | * is the exit event. 10 | */ 11 | var ShutdownRequest; 12 | (function (ShutdownRequest) { 13 | ShutdownRequest.type = { command: 'shutdown' }; 14 | })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {})); 15 | /** 16 | * The exit event is send from the client to the worker to 17 | * ask the worker to exit its process. 18 | */ 19 | 20 | -------------------------------------------------------------------------------- /test/test.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------- 2 | * Copyright (C) Microsoft Corporation. All rights reserved. 3 | *--------------------------------------------------------*/ 4 | 'use strict'; 5 | /** 6 | * The shutdown command is send from the client to the worker. 7 | * It is send once when the client descides to shutdown the 8 | * worker. The only event that is send after a shudown request 9 | * is the exit event. 10 | */ 11 | var ShutdownRequest; 12 | (function (ShutdownRequest) { 13 | ShutdownRequest.type = { command: 'shutdown' }; 14 | })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {})); 15 | /** 16 | * The exit event is send from the client to the worker to 17 | * ask the worker to exit its process. 18 | */ 19 | var ExitEvent; 20 | (function (ExitEvent) { 21 | ExitEvent.type = { event: 'exit' }; 22 | })(ExitEvent = exports.ExitEvent || (exports.ExitEvent = {})); 23 | var InitializeRequest; 24 | (function (InitializeRequest) { 25 | InitializeRequest.type = { command: 'initialize' }; 26 | })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {})); 27 | /** 28 | * The configuration change event is send from the client to the worker 29 | * when the client's configuration has changed. The event contains 30 | * the changed configuration as defined by the language worker statically 31 | * in it's extension manifest. 32 | */ 33 | var DidChangeConfigurationEvent; 34 | (function(DidChangeConfigurationEvent) { 35 | DidChangeConfigurationEvent.type = { event: 'workspace/didChangeConfiguration' }; 36 | })(DidChangeConfigurationEvent = exports.DidChangeConfigurationEvent || (exports.DidChangeConfigurationEvent = {})); 37 | var MessageSeverity; 38 | (function (MessageSeverity) { 39 | MessageSeverity.Error = 1; 40 | MessageSeverity.Warning = 2; 41 | MessageSeverity.Info = 3; 42 | })(MessageSeverity = exports.MessageSeverity || (exports.MessageSeverity = {})); 43 | /** 44 | * The show message event is send from a worker to a client to ask 45 | * the client to display a particular message in the user interface 46 | */ 47 | var ShowMessageEvent; 48 | (function(ShowMessageEvent) { 49 | ShowMessageEvent.type = { event: 'shell/showMessage' }; 50 | })(ShowMessageEvent = exports.ShowMessageEvent || (exports.ShowMessageEvent = {})); 51 | var LogMessageEvent; 52 | (function(LogMessageEvent) { 53 | LogMessageEvent.type = { event: 'shell/logMessage' }; 54 | })(LogMessageEvent = exports.LogMessageEvent || (exports.LogMessageEvent = {})); 55 | /** 56 | * The document event is send from the client to the worker to signal 57 | * newly opened, changed and closed documents. 58 | */ 59 | var DidOpenDocumentEvent; 60 | (function (DidOpenDocumentEvent) { 61 | DidOpenDocumentEvent.type = { event: 'document/didOpen' }; 62 | })(DidOpenDocumentEvent = exports.DidOpenDocumentEvent || (exports.DidOpenDocumentEvent = {})); 63 | var DidChangeDocumentEvent; 64 | (function (DidChangeDocumentEvent) { 65 | DidChangeDocumentEvent.type = { event: 'document/didChange' }; 66 | })(DidChangeDocumentEvent = exports.DidChangeDocumentEvent || (exports.DidChangeDocumentEvent = {})); 67 | var DidCloseDocumentEvent; 68 | (function (DidCloseDocumentEvent) { 69 | DidCloseDocumentEvent.type = { event: 'document/didClose' }; 70 | })(DidCloseDocumentEvent = exports.DidCloseDocumentEvent || (exports.DidCloseDocumentEvent = {})); 71 | /** 72 | */ 73 | var DidChangeFilesEvent; 74 | (function (DidChangeFilesEvent) { 75 | DidChangeFilesEvent.type = { event: 'workspace/didChangeFiles' }; 76 | })(DidChangeFilesEvent = exports.DidChangeFilesEvent || (exports.DidChangeFilesEvent = {})); 77 | var FileChangeType; 78 | (function (FileChangeType) { 79 | FileChangeType.Created = 1; 80 | FileChangeType.Changed = 2; 81 | FileChangeType.Deleted = 3; 82 | })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {})); 83 | /** 84 | * Diagnostics events are send from the worker to clients to signal 85 | * results of validation runs 86 | */ 87 | var PublishDiagnosticsEvent; 88 | (function (PublishDiagnosticsEvent) { 89 | PublishDiagnosticsEvent.type = { event: 'document/publishDiagnostics' }; 90 | })(PublishDiagnosticsEvent = exports.PublishDiagnosticsEvent || (exports.PublishDiagnosticsEvent = {})); 91 | var Severity; 92 | (function (Severity) { 93 | Severity.Error = 1; 94 | Severity.Warning = 2; 95 | Severity.Info = 3; 96 | })(Severity = exports.Severity || (exports.Severity = {})); 97 | -------------------------------------------------------------------------------- /test/test.jsx: -------------------------------------------------------------------------------- 1 | // Awkward block of variable declarations 2 | var Form = MyFormComponent; 3 | var FormRow = Form.Row; 4 | var FormLabel = Form.Label; 5 | var FormInput = Form.Input; 6 | 7 | var App = ( 8 |
9 | 10 | 11 | 12 | 13 |
14 | ); 15 | 16 | -------------------------------------------------------------------------------- /thirdpartynotices.txt: -------------------------------------------------------------------------------- 1 | THIRD-PARTY SOFTWARE NOTICES AND INFORMATION 2 | For Microsoft vscode-jscs 3 | 4 | This project incorporates material from the projects listed below. The original copyright notice 5 | and the license under which Microsoft received such material are set out below. Microsoft reserves 6 | all other rights not expressly granted, whether by implication, estoppel or otherwise. 7 | 8 | 1. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped) 9 | 10 | This project is licensed under the MIT license. 11 | Copyrights are respective of each contributor listed at the beginning of each definition file. 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in 21 | all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | THE SOFTWARE. --------------------------------------------------------------------------------