Skip to content

Commit

Permalink
Add linter
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tylenda committed Feb 6, 2024
1 parent 7af7420 commit e9efe38
Show file tree
Hide file tree
Showing 123 changed files with 2,383 additions and 302 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
end_of_line = lf
charset = utf-8

[*{.json,.yml}]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# don't ever lint node_modules
node_modules
228 changes: 228 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.base.json"
},
"plugins": [
"@typescript-eslint"
],
"ignorePatterns": [
"dist/",
"node_modules"
],
"extends": [
"plugin:import/recommended",
"plugin:import/typescript"
],
"rules": {
/* possible errors */
"no-cond-assign" : 2,
"no-console" : 0,
"no-constant-condition" : 2,
"no-control-regex" : 2,
"no-debugger" : 2,
"no-dupe-args" : 2,
"no-dupe-keys" : 2,
"no-duplicate-case" : 2,
"no-empty-character-class" : 2,
"no-empty" : 2,
"no-ex-assign" : 2,
"no-extra-boolean-cast" : 2,
"no-extra-parens" : 0,
"no-extra-semi" : 2,
"no-func-assign" : 2,
"no-inner-declarations" : 2,
"no-invalid-regexp" : 2,
"no-irregular-whitespace" : 2,
"no-negated-in-lhs" : 2,
"no-obj-calls" : 2,
"no-regex-spaces" : 2,
"no-sparse-arrays" : 2,
"no-unreachable" : 2,
"use-isnan" : 2,
"valid-jsdoc" : 0,
"valid-typeof" : 2,
"no-unexpected-multiline" : 2,

/* best practises */
"accessor-pairs" : 1,
"block-scoped-var" : 2,
"complexity" : [1, 9],
"consistent-return" : 2,
"curly" : 0, //TODO
"default-case" : 1,
"dot-notation" : 1,
"dot-location" : [1, "property"],
"eqeqeq" : 2,
"guard-for-in" : 1,
"no-alert" : 2,
"no-caller" : 1,
"no-div-regex" : 1,
"no-else-return" : 1,
"no-eq-null" : 2,
"no-eval" : 1,
"no-extend-native" : 0,

//"no-extra-bind" es6
"no-fallthrough" : 2,
"no-floating-decimal" : 1,
"no-implicit-coercion" : 0,
"no-implied-eval" : 2,

//"no-invalid-this" es6
"no-iterator" : 2,
"no-labels" : 2,
"no-lone-blocks" : 2,
"no-loop-func" : 2,
"no-multi-spaces" : 1,
"no-multi-str" : 2,
"no-native-reassign" : 2,
"no-new-func" : 2,
"no-new-wrappers" : 2,
"no-new" : 0,
"no-octal-escape" : 2,
"no-octal" : 2,
"no-param-reassign" : 0,

//"no-process-env" node
"no-proto" : 2,
"no-redeclare" : 2,
"no-return-assign" : 2,
"no-script-url" : 2,
"no-self-compare" : 2,
"no-sequences" : 1,
"no-throw-literal" : 1,
"no-unused-expressions" : 2,
"no-useless-concat" : 2,
"no-void" : 2,
"no-warning-comments" : 0,
"no-with" : 1,
"radix" : 2,
"vars-on-top" : 0,
"wrap-iife" : [2, "inside"],
"yoda" : 2,

/* variables */
"init-declarations" : 0,
"no-catch-shadow" : 2,
"no-delete-var" : 2,
"no-label-var" : 2,
"no-shadow-restricted-names" : 2,
"no-shadow" : 0,
"no-undef-init" : 2,
"no-undef" : 0,
"no-undefined:" : 0,
"no-use-before-define" : 2,
"prefer-const": 2,

/* stylistic issues */
"array-bracket-spacing" : 1,
"block-spacing" : 1,
"brace-style" : [1, "1tbs", {"allowSingleLine": true}],
"camelcase" : [1, {"properties": "never"}],
"comma-spacing" : 1,
"comma-style" : 1,
"computed-property-spacing" : 1,
"consistent-this": [1, "_this"],
"eol-last" : 2,
"func-names" : 0,
"func-style" : 0,
"id-length" : 0,
"id-match": 0,
"indent": [1, 4, { "SwitchCase": 1 }],
"key-spacing" : [0, {"beforeColon" : true, "afterColon" : true}],
"lines-around-comment" : 0,
"linebreak-style" : [2, "unix"],
"max-nested-callbacks" : [1, 3],
"new-cap" : 0,
"new-parens" : 1,
"newline-after-var" : 0,
"no-array-constructor" : 1,
"no-continue" : 0,
"no-inline-comments" : 0,
"no-lonely-if" : 1,
"no-mixed-spaces-and-tabs" : 1,
"no-multiple-empty-lines" : [2, {"max": 1}],
"no-nested-ternary" : 1,
"no-negated-condition" : 0,
"no-new-object" : 1,
"no-restricted-syntax" : 0,
"no-spaced-func" : 1,
"no-ternary" : 0,
"no-trailing-spaces" : [1, {"ignoreComments": true}],
"no-underscore-dangle" : 0,
"no-unneeded-ternary" : 1,
"object-curly-spacing" : [2, "always"],
"one-var" : 0,
"operator-assignment" : 1,
"operator-linebreak" : 1,
"padded-blocks": [2, "never"],
"padding-line-between-statements": [2,
{ "blankLine": "always", "prev": ["const", "let"], "next": "*" },
// Function definitions using const should be able to have blankLines between them
// but variable definitions shouldn't so let's trust the programmer here ;)
{ "blankLine": "any", "prev": ["const"], "next": ["const"] },
{ "blankLine": "any", "prev": ["const", "let"], "next":["const", "let"] },
{ "blankLine": "never", "prev": ["let"], "next": ["let"] },
{ "blankLine": "always", "prev": "directive", "next": "*" },
{ "blankLine": "any", "prev": "directive", "next": "directive" }
],
"quote-props": [1, "as-needed"],
"quotes": [ 2, "double"],
"require-jsdo" : 0,
"semi-spacing" : 1,
"semi": ["error", "always"],
"sort-vars" : 0,
"keyword-spacing" : ["error", { "before": true, "after": true }],
"space-before-function-paren" : [1, {"anonymous": "never", "named": "never", "asyncArrow": "always"}],
"space-in-parens": [1, "never"],
"space-infix-ops" : 1,
"space-unary-ops" : 1,
"spaced-comment" : 0,
"wrap-regex" : 1,
"@typescript-eslint/no-unused-vars": [2, {
"varsIgnorePattern" : "^(_this|options|defaults)",
"argsIgnorePattern" : "^(_|options|defaults)"}
],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-extra-parens" : 1,

"import/no-absolute-path": 2, // Forbid import of modules using absolute paths ()
"import/no-dynamic-require": 2, // Forbid require() calls with expressions ()
"import/no-self-import": 2, // Forbid a module from importing itself ()
"import/no-cycle": 2, // Forbid a module from importing a module with a dependency path back to itself ()
"import/no-useless-path-segments": 2, // Prevent unnecessary path segments in import and require statements ()
"import/no-relative-packages": 2, // Prevent importing packages through relative paths ()

"import/no-deprecated": 1, // Report imported names marked with @deprecated documentation tag ()
"import/no-extraneous-dependencies": [ "error", { "devDependencies": true } ], // Forbid the use of extraneous packages ()
"import/no-mutable-exports": 1, // Forbid the use of mutable exports with var or let. ()
"import/no-unused-modules": 1, // Report modules without exports, or exports without matching import in another module ()

"max-len": [
"warn",
{
"code": 120,
"tabWidth": 4,
"comments": 120,
"ignoreComments": false,
"ignoreTrailingComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}
],
"no-prototype-builtins": 2,
"no-useless-call": 2,
"no-async-promise-executor": 2,
"arrow-spacing": 2,
"func-call-spacing": 2,
"space-before-blocks": 2,
"rest-spread-spacing": 2,
"no-whitespace-before-property": 2
}
}
5 changes: 4 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ jobs:
- name: Setup Node18
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '18'

- name: Install TypeScript
run: npm install -g typescript@5.3.2

- name: Run Linter
run: yarn lint

- name: Install dependencies
run: yarn install

Expand Down
4 changes: 2 additions & 2 deletions js/args-config-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scramjet/args-config-test",
"version": "0.22.0",
"version": "0.25.3",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -17,6 +17,6 @@
},
"repository": {
"type": "git",
"url": "https://github.com/scramjetorg/transform-hub.git"
"url": "https://github.com/scramjetorg/reference-apps.git"
}
}
4 changes: 2 additions & 2 deletions js/args-to-output/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scramjet/args-to-output",
"version": "0.22.0",
"version": "0.25.3",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -17,6 +17,6 @@
},
"repository": {
"type": "git",
"url": "https://github.com/scramjetorg/transform-hub.git"
"url": "https://github.com/scramjetorg/reference-apps.git"
}
}
2 changes: 1 addition & 1 deletion js/audio2text-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "audio2text",
"version": "1.0.0",
"version": "0.25.3",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion js/audio2text-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Assembly } from "./utils/assembly";
const app: ReadableApp<any> = async function(
_stream,
token:string
) {
) {
const assembly = new Assembly(token);

await assembly.processFile();
Expand Down
2 changes: 1 addition & 1 deletion js/audio2text-js/src/utils/assembly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { defer } from "@scramjet/utility";
import { readFile } from "fs";
import path from "path";


export class Assembly {
//path to file change song.wav to name of your file
//file has to be in a same directory
Expand Down Expand Up @@ -47,6 +46,7 @@ export class Assembly {
.then((res) => { this.transciptId = res.data.id; });
}
private async transcript():Promise<string> {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, _reject) => {
while (this.status !== "completed") {
this.client
Expand Down
6 changes: 3 additions & 3 deletions js/avengers-names-output/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scramjet/avengers-names-output",
"version": "0.22.0",
"version": "0.25.3",
"description": "",
"main": "index.js",
"assets": [
Expand All @@ -27,6 +27,6 @@
},
"repository": {
"type": "git",
"url": "https://github.com/scramjetorg/transform-hub.git"
"url": "https://github.com/scramjetorg/reference-apps.git"
}
}
}
2 changes: 1 addition & 1 deletion js/bad-sequence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/scramjetorg/transform-hub.git"
"url": "https://github.com/scramjetorg/reference-apps.git"
}
}
6 changes: 3 additions & 3 deletions js/big-file-sequence/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scramjet/big-file-sequence",
"version": "0.22.0",
"version": "0.25.3",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -20,6 +20,6 @@
},
"repository": {
"type": "git",
"url": "https://github.com/scramjetorg/transform-hub.git"
"url": "https://github.com/scramjetorg/reference-apps.git"
}
}
}
6 changes: 3 additions & 3 deletions js/can-keep-alive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scramjet/can-keep-alive",
"version": "0.22.0",
"version": "0.25.3",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -20,6 +20,6 @@
},
"repository": {
"type": "git",
"url": "https://github.com/scramjetorg/transform-hub.git"
"url": "https://github.com/scramjetorg/reference-apps.git"
}
}
}
Loading

0 comments on commit e9efe38

Please sign in to comment.