Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"no-constant-condition": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
coverage/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
coverage
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 140,
"tabWidth": 4,
"semi": true,
"trailingComma": "none",
"singleQuote": false,
"quoteProps": "preserve"
Comment on lines +2 to +7
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем ? printWidth я могу понять, а остальное?

}
47 changes: 47 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest single run all tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
"-i",
"--no-cache"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest watch all tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest watch current file",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"${fileBasename}",
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
# otus-reactjs
Homework for https://otus.ru/lessons/react/

## Console calculator

Run calculator in REPL mode with

`npm start`

Supported operations:

Operation | Format
--- | ---
sum | `x + y`
substract | `x - y`
multiply | `x * y`
divide | `x / y`
| | |
remainder | `x % y`
power | `x ^ y`
square | `x **`
factorial | `x !`
| | |
sinus | `sin x`
cosinus | `cos x`
tangens | `tg x`
cotangens | `ctg x`
fibonacci | `fib x`

Pad numbers and operators with spaces, e.g. `1 + 2 + 3`.

Use parentheses `( )` to group operations, e.g. `5 * (3 ** - (2 + 1))` = 30

Trigonometric operations use radians, so `PI` is supported, e.g. `sin(PI / 2)` = 1.

Type `bye` or `quit` or `exit` to stop REPL.

## Tests

`npm test` will run tests

`npm run coverage` will run tests and generate coverage report
9 changes: 9 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
["@babel/env", {
"targets": {"node": "current"}
}
],
["@babel/preset-typescript"]
]
}
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
clearMocks: true,
coverageDirectory: "coverage",
testEnvironment: "node",
transform: {
"^.+\\.(js|ts)x?$": "<rootDir>/node_modules/babel-jest"
}
};
Loading