Browse Source

Updates to config and files to pass TSLint

Roel van Uden 9 years ago
parent
commit
25a077b495
10 changed files with 42 additions and 30 deletions
  1. 0 3
      crunchyroll.js.njsproj
  2. 8 0
      crunchyroll.js.sln.DotSettings
  3. 5 2
      package.json
  4. 5 1
      src/episode.ts
  5. 2 2
      src/request.ts
  6. 5 1
      src/series.ts
  7. 1 1
      src/subtitle/decode.ts
  8. 7 7
      src/video/merge.ts
  9. 4 1
      ts.js
  10. 5 12
      tslint.json

+ 0 - 3
crunchyroll.js.njsproj

@@ -63,9 +63,6 @@
     <Folder Include="typings\request\" />
     <Folder Include="typings\xml2js\" />
   </ItemGroup>
-  <ItemGroup>
-    <Compile Include="ts.js" />
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
   <Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />

+ 8 - 0
crunchyroll.js.sln.DotSettings

@@ -1,4 +1,5 @@
 <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+	<s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntellisenseGloballyEnabled/IntellisenseEnabled/@EntryValue">Disabled</s:String>
 	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=DeclarationHides/@EntryIndexedValue">DO_NOT_SHOW</s:String>
 	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InconsistentNaming/@EntryIndexedValue">DO_NOT_SHOW</s:String>
 	<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NotAllPathsReturnValue/@EntryIndexedValue">DO_NOT_SHOW</s:String>
@@ -46,6 +47,13 @@
 	<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPUBLIC_005FTYPE_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
 	<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPUBLIC_005FTYPE_005FMETHOD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
 	<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FTYPE_005FPARAMETER/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /&gt;</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/WebNaming/UserRules/=ASP_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/WebNaming/UserRules/=ASP_005FHTML_005FCONTROL/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/WebNaming/UserRules/=ASP_005FTAG_005FNAME/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/WebNaming/UserRules/=ASP_005FTAG_005FPREFIX/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=NAMESPACE_005FALIAS/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FRESOURCE/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
 	<s:Boolean x:Key="/Default/CodeStyle/TypeScriptCodeStyle/ExplicitPublicModifier/@EntryValue">True</s:Boolean>
 	<s:String x:Key="/Default/CodeStyle/TypeScriptCodeStyle/FileReferenceStyle/@EntryValue">RelativeDotSlash</s:String>
 	<s:Boolean x:Key="/Default/CodeStyle/TypeScriptCodeStyle/NoImplicitAny/@EntryValue">True</s:Boolean>

+ 5 - 2
package.json

@@ -7,7 +7,10 @@
     "crunchyroll"
   ],
   "name": "crunchyroll",
-  "repository": "git://github.com/Deathspike/crunchyroll.js.git",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/Deathspike/crunchyroll.js.git"
+  },
   "version": "1.1.0",
   "bin": {
     "crunchyroll": "./bin/crunchyroll"
@@ -29,4 +32,4 @@
     "prepublish": "npm run tsd && node ts",
     "tsd": "./node_modules/.bin/tsd reinstall --overwrite"
   }
-}
+}

+ 5 - 1
src/episode.ts

@@ -79,7 +79,11 @@ function downloadSubtitle(config: typings.IConfig, player: typings.IEpisodePlaye
 /**
  * Streams the video to disk.
  */
-function downloadVideo(config: typings.IConfig, page: typings.IEpisodePage, player: typings.IEpisodePlayer, filePath: string, done: (err: Error) => void) {
+function downloadVideo(config: typings.IConfig,
+  page: typings.IEpisodePage,
+  player: typings.IEpisodePlayer,
+  filePath: string,
+  done: (err: Error) => void) {
   video.stream(
     player.video.host,
     player.video.file,

+ 2 - 2
src/request.ts

@@ -17,8 +17,8 @@ export function get(config: typings.IConfig, options: request.Options, done: (er
 }
 
 /**
-* Performs a POST request for the resource.
-*/
+ * Performs a POST request for the resource.
+ */
 export function post(config: typings.IConfig, options: request.Options, done: (err: Error, result?: string) => void) {
   authenticate(config, err => {
     if (err) return done(err);

+ 5 - 1
src/series.ts

@@ -38,7 +38,11 @@ function main(config: typings.IConfig, address: string, done: (err: Error) => vo
 /**
  * Downloads the episode.
  */
-function download(cache: {[address: string]: number}, config: typings.IConfig, baseAddress: string, item: typings.ISeriesEpisode, done: (err: Error) => void) {
+function download(cache: {[address: string]: number},
+  config: typings.IConfig,
+  baseAddress: string,
+  item: typings.ISeriesEpisode,
+  done: (err: Error) => void) {
   if (!filter(config, item)) return done(null);
   var address = url.resolve(baseAddress, item.address);
   if (cache[address]) return done(null);

+ 1 - 1
src/subtitle/decode.ts

@@ -1,7 +1,7 @@
+/* tslint:disable:no-bitwise false */
 'use strict';
 export = main;
 import crypto = require('crypto');
-import bigInt = require('big-integer');
 import zlib = require('zlib');
 
 /**

+ 7 - 7
src/video/merge.ts

@@ -17,14 +17,14 @@ function main(config: typings.IConfig, rtmpInputPath: string, filePath: string,
     '-o "' + filePath + '.mkv" ' +
     '"' + videoPath + '" ' +
     '"' + subtitlePath + '"', {
-    maxBuffer: Infinity
-  }, err => {
-    if (err) return done(err);
-    unlink(videoPath, subtitlePath, err => {
-      if (err) unlinkTimeout(videoPath, subtitlePath, 5000);
-      done(null);
+      maxBuffer: Infinity
+    }, err => {
+      if (err) return done(err);
+      unlink(videoPath, subtitlePath, err => {
+        if (err) unlinkTimeout(videoPath, subtitlePath, 5000);
+        done(null);
+      });
     });
-  });
 }
 
 /**

+ 4 - 1
ts.js

@@ -48,7 +48,10 @@ function clean(filePaths, done) {
 function compile(filePaths, done) {
   var execPath = path.join(__dirname, 'node_modules/.bin/tsc');
   var options = '--declaration --module CommonJS --noImplicitAny --outDir dist';
-  childProcess.exec([execPath, options].concat(filePaths).join(' '), done);
+  childProcess.exec([execPath, options].concat(filePaths).join(' '), function(err, stdout) {
+      if (stdout) return done(new Error(stdout));
+      done(null);
+    });
 }
 
 /**

+ 5 - 12
tslint.json

@@ -3,11 +3,10 @@
     "ban": false,
     "class-name": true,
     "comment-format": [true,
-      "check-space",
-      "check-lowercase"
+      "check-space"
     ],
     "curly": false,
-    "eofline": true,
+    "eofline": false,
     "forin": true,
     "indent": [true, 2],
     "interface-name": true,
@@ -44,7 +43,7 @@
     "no-unused-expression": true,
     "no-unused-variable": true,
     "no-unreachable": true,
-    "no-use-before-declare": true,
+    "no-use-before-declare": false,
     "no-var-requires": true,
     "one-line": [true,
       "check-catch",
@@ -57,11 +56,8 @@
     "semicolon": true,
     "triple-equals": [true, "allow-null-check"],
     "typedef": [true,
-      "call-signature",
       "member-variable-declaration",
-      "parameter",
-      "property-declaration",
-      "variable-declaration" 
+      "property-declaration"
     ],
     "typedef-whitespace": [true, {
       "call-signature": "nospace",
@@ -70,10 +66,7 @@
       "property-declaration": "nospace",
       "variable-declaration": "nospace"
     }],
-    "use-strict": [true,
-      "check-module",
-      "check-function"
-    ],
+    "use-strict": false,
     "variable-name": false,
     "whitespace": [true,
       "check-branch",