當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript tslint.lint函數代碼示例

本文整理匯總了TypeScript中tslint.lint函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript lint函數的具體用法?TypeScript lint怎麽用?TypeScript lint使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了lint函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: lint

 function lint() {
     var session = IDE.sessionTabView.getActiveSession();
     var options = {
         formatter: "json",
         configuration: getLintConfig(),
         rulesDirectory: "customRules/",
         formattersDirectory: "customFormatters/"
     };
     
     if (session && session.isTypeScript()) {
             var Linter = require("tslint");
             var ll = new Linter(session.name, session.content, options);
             var result:Array<any> = JSON.parse(ll.lint().output);
             // console.log(result);
             // IDE.console.log(JSON.stringify(result,null,4));
             var r:Cats.FileRange[] = [];
             result.forEach((msg) => {
                     var item:Cats.FileRange = {
                           fileName : msg.name,
                           message: msg.failure,
                           severity: Cats.Severity.Info,
                           range: convertPos(msg)
                     };
                     r.push(item)
             });
             session.setErrors(r);
             IDE.problemResult.setData(r);
             
     }
 }
開發者ID:devlato,項目名稱:cats,代碼行數:30,代碼來源:editorcommands.ts

示例2: callback

		fs.readFile(params.filePath, 'utf8', (err, contents) => {
			if (err) {
				callback(err, null);
				return;
			}
			let linter = new Linter(params.filePath, contents, params.options);
			let result = linter.lint();

			result.output = result.output.split('\n').reduce((memo: string[], line: string) => {
				if (line !== '') {
					memo.push(line + '\n');
				}
				return memo;
			}, []).join('');

			callback(err, result);
		});
開發者ID:DefinitelyTyped,項目名稱:definition-tester,代碼行數:17,代碼來源:TSLintWorker.ts

示例3: Linter

            cb: (sf => {
                const filePath = sf.fileName;
                const contents = sf.getFullText();


                const linter = new Linter(filePath, contents, linterConfig.linterConfig, lintprogram);
                const lintResult = linter.lint();

                filePaths.push(filePath);
                if (lintResult.failureCount) {
                    // console.log(linterMessagePrefix, filePath, lintResult.failureCount); // DEBUG
                    errors = errors.concat(
                        lintResult.failures.map(
                            le => lintErrorToCodeError(le, contents)
                        )
                    );
                }
            })
開發者ID:hsyngkby,項目名稱:alm,代碼行數:18,代碼來源:lintWorker.ts

示例4: lint

 public lint(path: string) {
     var contents = fs.readFileSync(path, "utf8");
     var linter = new Linter(path, contents, this.options);
     var result = linter.lint();
     return result.output;
 }
開發者ID:palantir,項目名稱:eclipse-tslint,代碼行數:6,代碼來源:linterEndpoint.ts

示例5: TsLinter

 const results = filePaths.map((filePath, index) => {
   const content = contents[index];
   const linter = new TsLinter(filePath, content, options);
   return linter.lint();
 });
開發者ID:Mercateo,項目名稱:typedocs,代碼行數:5,代碼來源:tslint.ts


注:本文中的tslint.lint函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。