Skip to content

Commit

Permalink
Convert to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
jgeurts committed Nov 18, 2019
1 parent dec8c66 commit 04eb00f
Show file tree
Hide file tree
Showing 12 changed files with 903 additions and 527 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
171 changes: 171 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
'use strict';

module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
plugins: [
"jsdoc",
"promise",
"security",
'@typescript-eslint'
],
extends: [
'eslint:recommended',
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
env: {
browser: true,
},
rules: {
"curly": ["error", "all"],
"callback-return": ["error", ["callback", "cb", "next", "done"]],
"class-methods-use-this": "off",
"consistent-return": "off",
"handle-callback-err": ["error", "^.*err"],
"new-cap": "off",
"no-console": "error",
"no-else-return": "error",
"no-eq-null": "off",
"no-global-assign": "error",
"no-loop-func": "off",
"no-lone-blocks": "error",
"no-negated-condition": "error",
"no-shadow": "off",
"no-template-curly-in-string": "error",
"no-undef": "error",
"no-underscore-dangle": "off",
"no-unsafe-negation": "error",
"no-use-before-define": "off",
"no-useless-rename": "error",
"padding-line-between-statements": ["error",
{
"blankLine": "always", "prev": [
"directive",
"block",
"block-like",
"multiline-block-like",
"cjs-export",
"cjs-import",
"class",
"export",
"import",
"if"
], "next": "*"
},
{"blankLine": "never", "prev": "directive", "next": "directive"},
{"blankLine": "any", "prev": "*", "next": ["if", "for", "cjs-import", "import"]},
{"blankLine": "any", "prev": ["export", "import"], "next": ["export", "import"]},
{"blankLine": "always", "prev": "*", "next": ["try", "function", "switch"]},
{"blankLine": "always", "prev": "if", "next": "if"},
{"blankLine": "never", "prev": ["return", "throw"], "next": "*"}
],
"strict": ["error", "safe"],
"no-empty": "error",
"no-empty-function": "error",
"valid-jsdoc": "off",
"yoda": "error",

"import/no-unresolved": "off",
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': 'off',

"jsdoc/check-alignment": "error",
"jsdoc/check-indentation": "off",
"jsdoc/check-param-names": "off",
"jsdoc/check-tag-names": "error",
"jsdoc/check-types": "error",
"jsdoc/newline-after-description": "off",
"jsdoc/no-undefined-types": "off",
"jsdoc/require-description": "off",
"jsdoc/require-description-complete-sentence": "off",
"jsdoc/require-example": "off",
"jsdoc/require-hyphen-before-param-description": "error",
"jsdoc/require-param": "error",
"jsdoc/require-param-description": "off",
"jsdoc/require-param-name": "error",
"jsdoc/require-param-type": "error",
"jsdoc/require-returns-description": "off",
"jsdoc/require-returns-type": "error",
"jsdoc/valid-types": "error",

"security/detect-buffer-noassert": "error",
"security/detect-child-process": "error",
"security/detect-disable-mustache-escape": "error",
"security/detect-eval-with-expression": "error",
"security/detect-new-buffer": "error",
"security/detect-no-csrf-before-method-override": "error",
"security/detect-non-literal-fs-filename": "error",
"security/detect-non-literal-regexp": "error",
"security/detect-non-literal-require": "off",
"security/detect-object-injection": "off",
"security/detect-possible-timing-attacks": "error",
"security/detect-pseudoRandomBytes": "error",
"security/detect-unsafe-regex": "error",

// Override airbnb
"eqeqeq": ["error", "smart"],
"func-names": "error",
"id-length": ["error", {"exceptions": ["_", "$", "e", "i", "j", "k", "q", "x", "y"]}],
'indent': 'off',
"no-param-reassign": "off", // Work toward enforcing this rule
"radix": "off",
"spaced-comment": "off",
"max-len": "off",
"no-continue": "off",
'no-dupe-class-members': 'off',
"no-plusplus": "off",
"no-prototype-builtins": "off",
"no-restricted-syntax": [
"error",
"DebuggerStatement",
"LabeledStatement",
"WithStatement"
],
"no-restricted-properties": ["error", {
"object": "arguments",
"property": "callee",
"message": "arguments.callee is deprecated"
}, {
"property": "__defineGetter__",
"message": "Please use Object.defineProperty instead."
}, {
"property": "__defineSetter__",
"message": "Please use Object.defineProperty instead."
}],
'no-useless-constructor': 'off',
"no-useless-escape": "off",
"object-shorthand": ["error", "always", {
"ignoreConstructors": false,
"avoidQuotes": true,
"avoidExplicitReturnArrows": true
}],
"prefer-spread": "error",
"prefer-destructuring": "off",

'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': ["error"],
'@typescript-eslint/interface-name-prefix': ['error', 'never'],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/restrict-plus-operands': 'error',

// Special to this project
'max-classes-per-file': 'off',
'@typescript-eslint/max-classes-per-file': 'off',
},
};
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ nbproject
.eslintcache

package-lock.json

index.js
index.js.map
index.d.ts
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ dump.rdb

Dockerfile
Makefile

index.ts
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save-exact=true
package-lock=false
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### 2.0.0
* Convert to typescript
* Fix a handful of bugs as part of the typescript conversion

### 1.0.0

* Initial release - [Original source](https://github.com/RelistenNet/gapless.js)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Daniel Saewitz
Copyright (c) 2017 Daniel Saewitz, Jim Geurts

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gapless.js is a library for gapless audio playback. It is not intended to be a f

In short, it takes an array of audio tracks and utilizes HTML5 audio and the web audio API to enable gapless playback of individual tracks.

I will expand this README with more details in time. If you're interested in this library, don't hesitate to leave me a note with any questions.
This library targets ES2018, which should be supported by all evergreen browsers: Safari v12+, Chrome 75+, Firefox 58+.

You can see a sample of the library in use currently at <Relisten.live> which is the not-yet-released beta of the next version of <Relisten.net>

Expand Down
Loading

0 comments on commit 04eb00f

Please sign in to comment.