-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate tslint in favour of eslint (#28)
* test: set up eslint, remove tslint and format all files * test(.eslintignore): add .nyc_output and coverage directories
- Loading branch information
Showing
16 changed files
with
997 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.nyc_output | ||
coverage | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"plugins": ["@typescript-eslint", "eslint-comments", "mocha", "promise", "unicorn"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"airbnb-typescript/base", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"plugin:eslint-comments/recommended", | ||
"plugin:mocha/recommended", | ||
"plugin:promise/recommended", | ||
"plugin:unicorn/recommended", | ||
"prettier", | ||
"prettier/react", | ||
"prettier/@typescript-eslint" | ||
], | ||
"env": { | ||
"node": true, | ||
"browser": true, | ||
"mocha": true | ||
}, | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"createDefaultProgram": true, | ||
"ecmaVersion": 2020, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"no-use-before-define": ["error", { "functions": false, "classes": true, "variables": true }], | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-use-before-define": [ | ||
"error", | ||
{ "functions": false, "classes": true, "variables": true, "typedefs": true } | ||
], | ||
"react/destructuring-assignment": "off", | ||
"react/jsx-filename-extension": "off", | ||
// Common abbreviations are known and readable | ||
"unicorn/prevent-abbreviations": "off", | ||
"unicorn/filename-case": [ | ||
"error", | ||
{ | ||
"cases": { | ||
"camelCase": true, | ||
"pascalCase": true | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,30 @@ | ||
import { expect } from "chai"; | ||
import { describe, it } from "mocha"; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
import Calculator from "./Calculator"; | ||
import Calculator from './Calculator'; | ||
|
||
describe("Calculator", () => { | ||
it("has the correct initial value when no argument is supplied", () => expect(new Calculator().value()).equal(0)); | ||
it("has the correct initial value when an argument is supplied", () => expect(new Calculator(3).value()).equal(3)); | ||
describe('Calculator', () => { | ||
it('has the correct initial value when no argument is supplied', () => expect(new Calculator().value()).equal(0)); | ||
it('has the correct initial value when an argument is supplied', () => expect(new Calculator(3).value()).equal(3)); | ||
|
||
const calculator = new Calculator(); | ||
|
||
it("can add", () => expect(calculator.add(2).value()).equal(2)); | ||
it("can sub", () => expect(calculator.sub(1).value()).equal(1)); | ||
it("can mul", () => expect(calculator.mul(12).value()).equal(12)); | ||
it("can div", () => expect(calculator.div(2).value()).equal(6)); | ||
it("can mod", () => expect(calculator.mod(4).value()).equal(2)); | ||
// prettier-ignore | ||
it("can exp", () => expect(calculator.sub(1).exp().value()).equal(Math.E)); | ||
it("can ln", () => expect(calculator.ln().value()).equal(1)); | ||
it("can clear", () => expect(calculator.clear().value()).equal(0)); | ||
it('can add', () => expect(calculator.add(2).value()).equal(2)); | ||
it('can sub', () => expect(calculator.sub(1).value()).equal(1)); | ||
it('can mul', () => expect(calculator.mul(12).value()).equal(12)); | ||
it('can div', () => expect(calculator.div(2).value()).equal(6)); | ||
it('can mod', () => expect(calculator.mod(4).value()).equal(2)); | ||
it('can exp', () => expect(calculator.sub(1).exp().value()).equal(Math.E)); | ||
it('can ln', () => expect(calculator.ln().value()).equal(1)); | ||
it('can clear', () => expect(calculator.clear().value()).equal(0)); | ||
|
||
// prettier-ignore | ||
it("can invert", () => expect(calculator.clear().add(2).inverse().value()).equal(1 / 2)); | ||
it('can invert', () => expect(calculator.clear().add(2).inverse().value()).equal(1 / 2)); | ||
|
||
// prettier-ignore | ||
it("can sin", () => expect(calculator.clear().sin().value()).equal(0)); | ||
// prettier-ignore | ||
it("can cos", () => expect(calculator.clear().cos().value()).equal(1)); | ||
// prettier-ignore | ||
it("can tan", () => expect(calculator.clear().tan().value()).equal(0)); | ||
// prettier-ignore | ||
it("can sinh", () => expect(calculator.clear().sinh().value()).equal(0)); | ||
// prettier-ignore | ||
it("can cosh", () => expect(calculator.clear().cosh().value()).equal(1)); | ||
// prettier-ignore | ||
it("can tanh", () => expect(calculator.clear().tanh().value()).equal(0)); | ||
// prettier-ignore | ||
it("can asin", () => expect(calculator.clear().asin().value()).equal(0)); | ||
it('can sin', () => expect(calculator.clear().sin().value()).equal(0)); | ||
it('can cos', () => expect(calculator.clear().cos().value()).equal(1)); | ||
it('can tan', () => expect(calculator.clear().tan().value()).equal(0)); | ||
it('can sinh', () => expect(calculator.clear().sinh().value()).equal(0)); | ||
it('can cosh', () => expect(calculator.clear().cosh().value()).equal(1)); | ||
it('can tanh', () => expect(calculator.clear().tanh().value()).equal(0)); | ||
it('can asin', () => expect(calculator.clear().asin().value()).equal(0)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { expect } from "chai"; | ||
import { describe, it } from "mocha"; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
import div from "./div"; | ||
import div from './div'; | ||
|
||
describe("div", () => { | ||
it("works for non-zero argments", () => expect(div(6, 2)).equal(3)); | ||
it("works for zero arguments", () => expect(div(3, 0)).equal(0)); | ||
describe('div', () => { | ||
it('works for non-zero argments', () => expect(div(6, 2)).equal(3)); | ||
it('works for zero arguments', () => expect(div(3, 0)).equal(0)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export { default as add } from "./add"; | ||
export { default as sub } from "./sub"; | ||
export { default as mul } from "./mul"; | ||
export { default as div } from "./div"; | ||
export { default as ln } from "./ln"; | ||
export { default as mod } from "./mod"; | ||
export { default as Calculator } from "./Calculator"; | ||
export { default as add } from './add'; | ||
export { default as sub } from './sub'; | ||
export { default as mul } from './mul'; | ||
export { default as div } from './div'; | ||
export { default as ln } from './ln'; | ||
export { default as mod } from './mod'; | ||
export { default as Calculator } from './Calculator'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { expect } from "chai"; | ||
import { describe, it } from "mocha"; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
import ln from "./ln"; | ||
import ln from './ln'; | ||
|
||
describe("ln", () => { | ||
it("works for non-zero argments", () => expect(ln(1)).equal(0)); | ||
it("works for non-zero argments", () => expect(ln(Math.E)).equal(1)); | ||
it("works for zero arguments", () => expect(ln(0)).equal(0)); | ||
it("works for negative argments", () => expect(ln(-1)).equal(0)); | ||
it("works for negative argments", () => expect(ln(-Math.E)).equal(1)); | ||
describe('ln', () => { | ||
it('works for non-zero argments ln(1)=0', () => expect(ln(1)).equal(0)); | ||
it('works for non-zero argments ln(e)=1', () => expect(ln(Math.E)).equal(1)); | ||
it('works for zero arguments ln(0)=0', () => expect(ln(0)).equal(0)); | ||
it('works for negative argments ln(-1)=0', () => expect(ln(-1)).equal(0)); | ||
it('works for negative argments ln(-e)=1', () => expect(ln(-Math.E)).equal(1)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { expect } from "chai"; | ||
import { describe, it } from "mocha"; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
import mod from "./mod"; | ||
import mod from './mod'; | ||
|
||
describe("mod", () => { | ||
it("works for non-zero argments", () => expect(mod(6, 4)).equal(2)); | ||
it("works for zero arguments", () => expect(mod(3, 0)).equal(0)); | ||
describe('mod', () => { | ||
it('works for non-zero argments', () => expect(mod(6, 4)).equal(2)); | ||
it('works for zero arguments', () => expect(mod(3, 0)).equal(0)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* The modulus of two numbers | ||
* Computes the modulus of two numbers | ||
* | ||
* Returns 0, if `b` is 0 | ||
*/ | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.