Skip to content

Commit c502a8d

Browse files
committed
linting
1 parent 685a47d commit c502a8d

File tree

11 files changed

+4583
-5305
lines changed

11 files changed

+4583
-5305
lines changed

.codeclimate.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/coverage.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
matrix:
1313
node: [ 18, 20, 21 ]
1414
env:
15-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
1615
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1716
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
1817
name: Node ${{ matrix.node }}
@@ -30,21 +29,9 @@ jobs:
3029
npm ci
3130
npm install -g c8
3231
33-
- name: Code Climate (Before)
34-
if: ${{ github.event_name != 'pull_request' && env.CC_TEST_REPORTER_ID != '' && matrix.node == 20 }}
35-
run: |
36-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./codeclimate-test-reporter
37-
chmod +x codeclimate-test-reporter
38-
./codeclimate-test-reporter before-build
39-
4032
- name: Run Coverage Testing
4133
run: npm run coverage
4234

43-
- name: Code Climate (After)
44-
if: ${{ github.event_name != 'pull_request' && env.CC_TEST_REPORTER_ID != '' && matrix.node == 20 }}
45-
run: |
46-
./codeclimate-test-reporter after-build -t lcov --exit-code $?
47-
4835
- name: Codecov
4936
if: ${{ github.event_name != 'pull_request' && env.CODECOV_TOKEN != '' && matrix.node == 20 }}
5037
run: |

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
.git
22
.github
3+
.sonarlint
4+
.vscode
5+
36
coverage
47
docs
58
node_modules

.sonarlint/connectedMode.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sonarCloudOrganization": "cityssm",
3+
"projectKey": "cityssm_string-to-numeric",
4+
"region": "EU"
5+
}

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sonarlint.connectedMode.project": {
3+
"connectionId": "cityssm",
4+
"projectKey": "cityssm_string-to-numeric"
5+
}
6+
}

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
[![npm (scoped)](https://img.shields.io/npm/v/@cityssm/string-to-numeric)](https://www.npmjs.com/package/@cityssm/string-to-numeric)
44
[![DeepSource](https://app.deepsource.com/gh/cityssm/string-to-numeric.svg/?label=active+issues&show_trend=true&token=rG6OhTeMrjbjhlPrScSXEKEL)](https://app.deepsource.com/gh/cityssm/string-to-numeric/)
5-
[![Maintainability](https://api.codeclimate.com/v1/badges/7cb058ead328616dc6e2/maintainability)](https://codeclimate.com/github/cityssm/string-to-numeric/maintainability)
65
[![codecov](https://codecov.io/gh/cityssm/string-to-numeric/graph/badge.svg?token=UGLDLEM3AW)](https://codecov.io/gh/cityssm/string-to-numeric)
76
[![Coverage Testing](https://github.com/cityssm/string-to-numeric/actions/workflows/coverage.yml/badge.svg)](https://github.com/cityssm/string-to-numeric/actions/workflows/coverage.yml)
87

index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type DecimalSeparator = '.' | ',';
1+
type DecimalSeparator = ',' | '.';
22
export interface ParsingOptions {
33
decimalSeparator: DecimalSeparator;
44
}
@@ -8,6 +8,6 @@ export interface ParsingOptions {
88
*/
99
export declare function getLocaleDecimalSeparator(): DecimalSeparator;
1010
export declare const defaultParsingOptions: ParsingOptions;
11-
export declare function parseNumeric(numericString: undefined | null, userParsingOptions?: Partial<ParsingOptions>): undefined;
11+
export declare function parseNumeric(numericString: null | undefined, userParsingOptions?: Partial<ParsingOptions>): undefined;
1212
export declare function parseNumeric(numericString: string, userParsingOptions?: Partial<ParsingOptions>): number;
1313
export default parseNumeric;

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const numbers = '0123456789';
66
* @returns Either "." or ",".
77
*/
88
export function getLocaleDecimalSeparator() {
9+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
910
return (1.1).toLocaleString().charAt(1);
1011
}
1112
export const defaultParsingOptions = {

index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @eslint-community/eslint-comments/disable-enable-pair */
22
/* eslint-disable @typescript-eslint/no-magic-numbers */
33

4-
type DecimalSeparator = '.' | ','
4+
type DecimalSeparator = ',' | '.'
55

66
const numbers = '0123456789'
77

@@ -14,6 +14,7 @@ export interface ParsingOptions {
1414
* @returns Either "." or ",".
1515
*/
1616
export function getLocaleDecimalSeparator(): DecimalSeparator {
17+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
1718
return (1.1).toLocaleString().charAt(1) as DecimalSeparator
1819
}
1920

@@ -22,9 +23,10 @@ export const defaultParsingOptions: ParsingOptions = {
2223
}
2324

2425
export function parseNumeric(
25-
numericString: undefined | null,
26+
numericString: null | undefined,
2627
userParsingOptions?: Partial<ParsingOptions>
2728
): undefined
29+
2830
export function parseNumeric(
2931
numericString: string,
3032
userParsingOptions?: Partial<ParsingOptions>
@@ -37,14 +39,14 @@ export function parseNumeric(
3739
* @returns A numeric representation of the given string.
3840
*/
3941
export function parseNumeric(
40-
numericString: string | undefined | null,
42+
numericString: string | null | undefined,
4143
userParsingOptions?: Partial<ParsingOptions>
4244
): number | undefined {
4345
if (numericString === undefined || numericString === null) {
4446
return undefined
4547
}
4648

47-
const options = { ...defaultParsingOptions, ...userParsingOptions}
49+
const options = { ...defaultParsingOptions, ...userParsingOptions }
4850

4951
let finalMultiplier = 1
5052

0 commit comments

Comments
 (0)