-
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.
- Loading branch information
1 parent
e613364
commit e7db3a1
Showing
8 changed files
with
112 additions
and
111 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,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 |
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,49 +1,34 @@ | ||
{ | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"airbnb-base" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 11, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
4, | ||
{"SwitchCase": 1} | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"linebreak-style": "off", | ||
"arrow-parens": [ | ||
"error", | ||
"as-needed" | ||
], | ||
"object-curly-spacing": [ | ||
"error", | ||
"never" | ||
], | ||
"comma-dangle": [ | ||
"error", | ||
"never" | ||
], | ||
"no-console": "off", | ||
"max-len": "off", | ||
"no-plusplus": "off", | ||
"strict": "off", | ||
"consistent-return": "off", | ||
"no-loop-func": "off", | ||
"no-shadow": "off" | ||
} | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"airbnb-base", | ||
"plugin:ava/recommended", | ||
"plugin:import/recommended", | ||
"plugin:unicorn/recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2023, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"indent": ["error", "tab", {"SwitchCase": 1}], | ||
"no-tabs": "off", | ||
"quotes": ["error", "single"], | ||
"semi": ["error", "always"], | ||
"linebreak-style": "off", | ||
"arrow-parens": ["error", "as-needed"], | ||
"object-curly-spacing": ["error", "never"], | ||
"comma-dangle": ["error", "never"], | ||
"no-console": "off", | ||
"max-len": "off", | ||
"no-plusplus": "off", | ||
"strict": "off", | ||
"consistent-return": "off", | ||
"no-loop-func": "off", | ||
"no-shadow": "off" | ||
} | ||
} |
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,2 +1 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
* text=auto eol=lf |
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,26 +1,24 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const squareAndMultiply = require('square-and-multiply'); | ||
const meow = require('meow'); | ||
import squareAndMultiply from 'square-and-multiply'; | ||
import meow from 'meow'; | ||
|
||
const cli = meow(` | ||
Usage | ||
$ square-and-multiply <base> <exponent> <modulus> | ||
Examples | ||
$ square-and-multiply 14 27 37 | ||
$ square-and-multiply 23 22 86 | ||
`); | ||
Usage | ||
$ square-and-multiply <base> <exponent> <modulus> | ||
Examples | ||
$ square-and-multiply 14 27 37 | ||
$ square-and-multiply 23 22 86 | ||
`, {importMeta: import.meta}); | ||
|
||
const basis = cli.input[0]; | ||
const exponent = cli.input[1]; | ||
const modulus = cli.input[2]; | ||
|
||
if (!(basis && exponent && modulus)) { | ||
console.log('You need to specify all three numbers.'); | ||
process.exit(1); | ||
console.log('You need to specify all three numbers.'); | ||
process.exit(1); | ||
} | ||
|
||
console.log(squareAndMultiply(basis, exponent, modulus)); |
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,37 +1,44 @@ | ||
{ | ||
"name": "square-and-multiply-cli", | ||
"version": "2.0.1", | ||
"description": "Get the square and multiply CLI", | ||
"repository": "knutkirkhorn/square-and-multiply-cli", | ||
"bin": { | ||
"square-and-multiply": "cli.js" | ||
}, | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "ava", | ||
"lint": "eslint ." | ||
}, | ||
"files": [ | ||
"cli.js" | ||
], | ||
"keywords": [ | ||
"square", | ||
"and", | ||
"multiply", | ||
"math", | ||
"cli" | ||
], | ||
"author": "Knut Kirkhorn", | ||
"license": "MIT", | ||
"dependencies": { | ||
"meow": "^8.1.0", | ||
"square-and-multiply": "^1.0.5" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"eslint": "^7.26.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"execa": "^5.0.0" | ||
} | ||
"name": "square-and-multiply-cli", | ||
"version": "2.0.1", | ||
"description": "Get the square and multiply CLI", | ||
"repository": "knutkirkhorn/square-and-multiply-cli", | ||
"bin": { | ||
"square-and-multiply": "cli.js" | ||
}, | ||
"scripts": { | ||
"test": "ava", | ||
"lint": "eslint ." | ||
}, | ||
"files": [ | ||
"cli.js" | ||
], | ||
"keywords": [ | ||
"square", | ||
"and", | ||
"multiply", | ||
"math", | ||
"cli" | ||
], | ||
"author": "Knut Kirkhorn", | ||
"type": "module", | ||
"exports": "./index.js", | ||
"types": "./index.d.ts", | ||
"engines": { | ||
"node": ">=14.16" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"meow": "^11.0.0", | ||
"square-and-multiply": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^5.2.0", | ||
"eslint": "^8.34.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-ava": "^14.0.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-unicorn": "^45.0.2", | ||
"execa": "^7.0.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,8 @@ | ||
const test = require('ava'); | ||
const execa = require('execa'); | ||
// eslint-disable-next-line import/no-unresolved | ||
import test from 'ava'; | ||
import {execa} from 'execa'; | ||
|
||
test('outprint something', async t => { | ||
const {stdout} = await execa('./cli.js', ['--version']); | ||
t.true(stdout.length > 0); | ||
const {stdout} = await execa('./cli.js', ['--version']); | ||
t.true(stdout.length > 0); | ||
}); |