Skip to content

Commit

Permalink
Migration from tslint on eslint javascript-obfuscator#1
Browse files Browse the repository at this point in the history
  • Loading branch information
sanex3339 committed Jan 30, 2020
1 parent b575fb3 commit 64b61a7
Show file tree
Hide file tree
Showing 112 changed files with 1,256 additions and 286 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/test
/webpack
260 changes: 260 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "src/tsconfig.node.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"import",
"jsdoc",
"prefer-arrow",
"unicorn"
],
"rules": {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-assertions": "off",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/indent": [
"off",
4
],
"@typescript-eslint/interface-name-prefix": [
"error",
"always"
],
"@typescript-eslint/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-param-reassign": "off",
"@typescript-eslint/no-parameter-properties": "error",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/quotes": "off",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/semi": [
"error",
"always"
],
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "off",
"arrow-parens": [
"off",
"as-needed"
],
"camelcase": "off",
"capitalized-comments": [
"off"
],
"comma-dangle": "off",
"complexity": [
"error",
{
"max": 10
}
],
"constructor-super": "error",
"curly": "error",
"default-case": "off",
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"id-blacklist": "off",
"id-match": "off",
"import/no-default-export": "error",
"import/no-deprecated": "off",
"import/no-extraneous-dependencies": "off",
"import/no-internal-modules": "error",
"import/no-unassigned-import": "off",
"import/order": [
"off"
],
"jsdoc/no-types": "off",
"linebreak-style": "error",
"max-classes-per-file": [
"error",
1
],
"max-len": "off",
"max-lines": [
"error",
500
],
"new-parens": "error",
"newline-per-chained-call": "off",
"no-bitwise": "off",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": [
"error",
{
"allow": [
"log",
"warn",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"dirxml",
"error",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"no-constant-condition": "error",
"no-control-regex": "off",
"no-debugger": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "off",
"no-eval": "off",
"no-extra-bind": "error",
"no-extra-semi": "error",
"no-fallthrough": "off",
"no-invalid-regexp": "error",
"no-invalid-this": "off",
"no-irregular-whitespace": "error",
"no-magic-numbers": "off",
"no-multi-str": "off",
"no-multiple-empty-lines": "error",
"no-new-wrappers": "error",
"no-null/no-null": "off",
"no-octal": "error",
"no-octal-escape": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-restricted-syntax": [
"error",
"ForInStatement"
],
"no-return-await": "error",
"no-sequences": "error",
"no-shadow": [
"error",
{
"hoist": "all"
}
],
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
"no-trailing-spaces": [
"error",
{
"skipBlankLines": true
}
],
"no-undef-init": "error",
"no-underscore-dangle": "off",
"no-unsafe-finally": "error",
"no-unused-expressions": "off",
"no-unused-labels": "error",
"no-var": "error",
"no-void": "error",
"object-shorthand": "off",
"one-var": [
"error",
"never"
],
"padding-line-between-statements": [
"error",
{
"blankLine": "always",
"prev": "*",
"next": "return"
}
],
"prefer-arrow/prefer-arrow-functions": "off",
"prefer-const": "error",
"prefer-object-spread": "off",
"prefer-template": "error",
"quote-props": [
"error",
"as-needed"
],
"radix": "error",
"space-before-function-paren": "error",
"spaced-comment": "error",
"space-in-parens": [
"error",
"never"
],
"unicorn/catch-error-name": [
"error",
{
"name": "error"
}
],
"unicorn/no-array-instanceof": "error",
"unicorn/no-nested-ternary": "error",
"unicorn/no-unreadable-array-destructuring": "error",
"unicorn/prefer-includes": "error",
"unicorn/prefer-starts-ends-with": "error",
"unicorn/prefer-trim-start-end": "error",
"use-isnan": "error",
"valid-typeof": "off",
"yoda": "error"
}
};
4 changes: 2 additions & 2 deletions dist/index.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.cli.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"estraverse": "4.3.0",
"eventemitter3": "4.0.0",
"fast-deep-equal": "3.1.1",
"fork-ts-checker-webpack-plugin": "3.1.1",
"inversify": "5.0.1",
"js-string-escape": "1.0.1",
"md5": "2.2.1",
Expand All @@ -61,8 +60,17 @@
"@types/sinon": "7.5.1",
"@types/string-template": "1.0.2",
"@types/webpack-env": "1.15.0",
"@typescript-eslint/eslint-plugin": "2.18.0",
"@typescript-eslint/parser": "2.18.0",
"chai": "4.2.0",
"coveralls": "3.0.9",
"eslint": "6.8.0",
"eslint-plugin-import": "2.20.0",
"eslint-plugin-jsdoc": "21.0.0",
"eslint-plugin-no-null": "1.0.2",
"eslint-plugin-prefer-arrow": "1.1.7",
"eslint-plugin-unicorn": "15.0.1",
"fork-ts-checker-webpack-plugin": "4.0.3",
"mocha": "7.0.0",
"nyc": "15.0.0",
"pjson": "1.0.9",
Expand All @@ -72,10 +80,6 @@
"threads": "1.0.0",
"ts-loader": "6.2.1",
"ts-node": "6.1.0",
"tslint": "5.20.1",
"tslint-eslint-rules": "5.4.0",
"tslint-language-service": "0.9.9",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "3.8.0-beta",
"webpack": "4.41.5",
"webpack-cli": "3.3.10",
Expand All @@ -102,7 +106,7 @@
"test:mocha": "scripts/test-mocha",
"test:removeTmpDir": "scripts/test-remove-tmp-dir",
"test": "scripts/test",
"tslint": "scripts/tslint",
"eslint": "scripts/eslint",
"travis": "scripts/travis",
"git:addFiles": "scripts/git-add-files",
"postinstall": "opencollective || exit 0"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

yarn run removeCacheDir &&
yarn run webpack:prod &&
yarn run tslint &&
yarn run eslint &&
yarn test
3 changes: 3 additions & 0 deletions scripts/eslint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

$(yarn bin)/eslint src/**/*.ts
2 changes: 1 addition & 1 deletion scripts/travis
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

yarn run tslint &&
yarn run eslint &&
yarn test
3 changes: 0 additions & 3 deletions scripts/tslint

This file was deleted.

2 changes: 1 addition & 1 deletion src/JavaScriptObfuscator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
* @param {ILogger} logger
* @param {IOptions} options
*/
constructor (
public constructor (
@inject(ServiceIdentifiers.ITransformersRunner) transformersRunner: ITransformersRunner,
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
@inject(ServiceIdentifiers.Factory__IObfuscatedCode) obfuscatedCodeFactory: TObfuscatedCodeFactory,
Expand Down
2 changes: 1 addition & 1 deletion src/analyzers/calls-graph-analyzer/CallsGraphAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class CallsGraphAnalyzer implements ICallsGraphAnalyzer {
*/
private readonly calleeDataExtractorFactory: TCalleeDataExtractorFactory;

constructor (
public constructor (
@inject(ServiceIdentifiers.Factory__ICalleeDataExtractor) calleeDataExtractorFactory: TCalleeDataExtractorFactory
) {
this.calleeDataExtractorFactory = calleeDataExtractorFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class PrevailingKindOfVariablesAnalyzer implements IPrevailingKindOfVaria
*/
private prevailingKindOfVariables: ESTree.VariableDeclaration['kind'] = PrevailingKindOfVariablesAnalyzer.defaultKindOfVariables;

constructor (
public constructor (
@inject(ServiceIdentifiers.IArrayUtils) arrayUtils: IArrayUtils
) {
this.arrayUtils = arrayUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class StringArrayStorageAnalyzer implements IStringArrayStorageAnalyzer {
* @param {IRandomGenerator} randomGenerator
* @param {IOptions} options
*/
constructor (
public constructor (
@inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStringArrayStorage,
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
@inject(ServiceIdentifiers.IOptions) options: IOptions,
Expand Down
2 changes: 1 addition & 1 deletion src/cli/JavaScriptObfuscatorCLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
/**
* @param {string[]} argv
*/
constructor (argv: string[]) {
public constructor (argv: string[]) {
this.rawArguments = argv;
this.arguments = argv.slice(2);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/sanitizers/ArraySanitizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TCLISanitizer } from '../../types/cli/TCLISanitizer';
* @returns {string[]}
*/
export const ArraySanitizer: TCLISanitizer <string[]> = (value: string): string[] => {
if (/,$/.test(value)) {
if (value.endsWith(',')) {
throw new SyntaxError(`Multiple <list> values should be wrapped inside quotes: --option-name 'value1','value2'`);
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/utils/SourceCodeReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class SourceCodeReader {
/**
* @param {TInputCLIOptions} options
*/
constructor (options: TInputCLIOptions) {
public constructor (options: TInputCLIOptions) {
this.options = options;
}

Expand Down
Loading

0 comments on commit 64b61a7

Please sign in to comment.