-
-
Notifications
You must be signed in to change notification settings - Fork 125
chore(ts): init typescript conf + tsify tokenize-arg-string #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7c24670
chore(ts): init typescript conf + tsify tokenize-arg-string
QmarkC 88fc857
fix(deps): update dependency decamelize to v3 (#274)
QmarkC 0c8001d
build!: drops Node 6. begin following Node.js LTS schedule (#278)
37e6354
build: switch to release-please action (#280)
729ff4d
feat(deps): update to latest camelcase/decamelize (#281)
b6b9237
chore(ts): update ecmaVersion to match node v10 engine
QmarkC 0bcfd40
Merge branch 'master' into 265-tsify-tokenize-arg-string
QmarkC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 | ||
|
|
||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| indent_size = 2 | ||
| indent_style = space | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
|
|
||
| [*.md] | ||
| trim_trailing_whitespace = false |
This file contains hidden or 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,21 @@ | ||
| { | ||
| "overrides": [ | ||
| { | ||
| "files": "*.ts", | ||
| "parser": "@typescript-eslint/parser", | ||
| "rules": { | ||
| "no-unused-vars": "off", | ||
| "no-useless-constructor": "off", | ||
| "@typescript-eslint/no-unused-vars": "error", | ||
| "@typescript-eslint/no-useless-constructor": "error" | ||
| } | ||
| } | ||
| ], | ||
| "parserOptions": { | ||
| "ecmaVersion": 2018, | ||
| "sourceType": "module" | ||
| }, | ||
| "plugins": [ | ||
| "@typescript-eslint/eslint-plugin" | ||
| ] | ||
| } | ||
This file contains hidden or 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,4 +1,5 @@ | ||
| .idea | ||
| build/ | ||
| .nyc_output | ||
| node_modules | ||
| .DS_Store | ||
|
|
||
This file contains hidden or 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,6 @@ | ||
| { | ||
| "spec": [ | ||
| "build/test", | ||
| "test" | ||
| ] | ||
| } |
This file contains hidden or 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,13 @@ | ||
| { | ||
| "exclude": [ | ||
| "build/test/**", | ||
| "test/**" | ||
| ], | ||
| "reporter": [ | ||
| "html", | ||
| "text" | ||
| ], | ||
| "lines": 100, | ||
| "branches": "97", | ||
| "statements": "100" | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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,133 @@ | ||
| /* global describe, it */ | ||
| import { expect, should } from 'chai' | ||
| import { tokenizeArgString } from '../lib/tokenize-arg-string' | ||
|
|
||
| should() | ||
|
QmarkC marked this conversation as resolved.
|
||
|
|
||
| describe('TokenizeArgString', function () { | ||
| it('handles unquoted string', function () { | ||
| const args = tokenizeArgString('--foo 99') | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('99') | ||
| }) | ||
|
|
||
| it('handles unquoted numbers', function () { | ||
| const args = tokenizeArgString(['--foo', 9]) | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('9') | ||
| }) | ||
|
|
||
| it('handles quoted string with no spaces', function () { | ||
| const args = tokenizeArgString("--foo 'hello'") | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal("'hello'") | ||
| }) | ||
|
|
||
| it('handles single quoted string with spaces', function () { | ||
| const args = tokenizeArgString("--foo 'hello world' --bar='foo bar'") | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal("'hello world'") | ||
| args[2].should.equal("--bar='foo bar'") | ||
| }) | ||
|
|
||
| it('handles double quoted string with spaces', function () { | ||
| const args = tokenizeArgString('--foo "hello world" --bar="foo bar"') | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('"hello world"') | ||
| args[2].should.equal('--bar="foo bar"') | ||
| }) | ||
|
|
||
| it('handles single quoted empty string', function () { | ||
| const args = tokenizeArgString('--foo \'\' --bar=\'\'') | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal("''") | ||
| args[2].should.equal("--bar=''") | ||
| }) | ||
|
|
||
| it('handles double quoted empty string', function () { | ||
| const args = tokenizeArgString('--foo "" --bar=""') | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('""') | ||
| args[2].should.equal('--bar=""') | ||
| }) | ||
|
|
||
| it('handles quoted string with embedded quotes', function () { | ||
| var args = tokenizeArgString('--foo "hello \'world\'" --bar=\'foo "bar"\'') | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('"hello \'world\'"') | ||
| args[2].should.equal('--bar=\'foo "bar"\'') | ||
| }) | ||
|
|
||
| // https://github.com/yargs/yargs-parser/pull/100 | ||
| // https://github.com/yargs/yargs-parser/pull/106 | ||
| it('ignores unneeded spaces', function () { | ||
| const args = tokenizeArgString(' foo bar "foo bar" ') | ||
| args[0].should.equal('foo') | ||
| expect(args[1]).equal('bar') | ||
| expect(args[2]).equal('"foo bar"') | ||
| }) | ||
|
|
||
| it('handles boolean options', function () { | ||
| const args = tokenizeArgString('--foo -bar') | ||
| expect(args[0]).to.equal(('--foo')) | ||
| expect(args[1]).to.equal(('-bar')) | ||
| }) | ||
|
|
||
| it('handles empty string', function () { | ||
| const args = tokenizeArgString('') | ||
| expect(args.length).to.equal(0) | ||
| }) | ||
|
|
||
| it('handles array with unquoted string', function () { | ||
| const args = tokenizeArgString(['--foo', '99']) | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('99') | ||
| }) | ||
|
|
||
| it('handles array with quoted string with no spaces', function () { | ||
| const args = tokenizeArgString(['--foo', "'hello'"]) | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal("'hello'") | ||
| }) | ||
|
|
||
| it('handles array with single quoted string with spaces', function () { | ||
| const args = tokenizeArgString(['--foo', "'hello world'", "--bar='foo bar'"]) | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal("'hello world'") | ||
| args[2].should.equal("--bar='foo bar'") | ||
| }) | ||
|
|
||
| it('handles array with double quoted string with spaces', function () { | ||
| const args = tokenizeArgString(['--foo', '"hello world"', '--bar="foo bar"']) | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('"hello world"') | ||
| args[2].should.equal('--bar="foo bar"') | ||
| }) | ||
|
|
||
| it('handles array with single quoted empty string', function () { | ||
| const args = tokenizeArgString(['--foo', "''", "--bar=''"]) | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal("''") | ||
| args[2].should.equal("--bar=''") | ||
| }) | ||
|
|
||
| it('handles array with double quoted empty string', function () { | ||
| const args = tokenizeArgString(['--foo', '""', '--bar=""']) | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('""') | ||
| args[2].should.equal('--bar=""') | ||
| }) | ||
|
|
||
| it('handles array with quoted string with embedded quotes', function () { | ||
| var args = tokenizeArgString(['--foo', '"hello \'world\'"', '--bar=\'foo "bar"\'']) | ||
| args[0].should.equal('--foo') | ||
| args[1].should.equal('"hello \'world\'"') | ||
| args[2].should.equal('--bar=\'foo "bar"\'') | ||
| }) | ||
|
|
||
| it('handles array with boolean options', function () { | ||
| const args = tokenizeArgString(['--foo', '-bar']) | ||
| expect(args[0]).to.equal('--foo') | ||
| expect(args[1]).to.equal('-bar') | ||
| }) | ||
| }) | ||
This file contains hidden or 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,11 @@ | ||
| { | ||
| "extends": "./node_modules/gts/tsconfig-google.json", | ||
| "compilerOptions": { | ||
| "outDir": "build", | ||
| "rootDir": ".", | ||
| "sourceMap": false | ||
| }, | ||
| "include": [ | ||
| "lib/**/*.ts" | ||
| ] | ||
| } |
This file contains hidden or 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,10 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "sourceMap": true | ||
| }, | ||
| "include": [ | ||
| "lib/**/*.ts", | ||
| "test/**/*.ts" | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.