diff --git a/.editorconfig b/.editorconfig
index e98f58d..ea8f4ab 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,18 +1,17 @@
-# EditorConfig: http://EditorConfig.org
+# EditorConfig is awesome: https://EditorConfig.org
-# top-most EditorConfig file
root = true
-# Unix-style newlines with a newline ending every file
[*]
-charset = utf-8
end_of_line = lf
-trim_trailing_whitespace = true
insert_final_newline = true
+
+[*.{js,d.ts,ts}]
+charset = utf-8
+trim_trailing_whitespace = true
indent_style = space
indent_size = 4
-# 2 space indentation
-[*.yaml, *.yml]
+[package.json,*.yaml]
indent_style = space
indent_size = 2
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..94f480d
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto eol=lf
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index e7ef1ee..bac2cd5 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# Global
node_modules/
+coverage
# OS Generated
.DS_Store*
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec352b3..8a12325 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+
+# [2.1.0](https://github.com/faker-javascript/ip) (2022-01-12)
+* Added xo, tsd, c8.
+* Improved tests.
+
# [2.0.1](https://github.com/faker-javascript/ip) (2022-01-10)
* GitHub docs updates.
diff --git a/index.d.ts b/index.d.ts
new file mode 100644
index 0000000..0bcf694
--- /dev/null
+++ b/index.d.ts
@@ -0,0 +1 @@
+export default function ip(): string;
diff --git a/index.js b/index.js
index e455175..11899b7 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,6 @@
export default function ip() {
- return Math.floor(Math.random() * 255) + '.' +
- Math.floor(Math.random() * 255) + '.' +
- Math.floor(Math.random() * 255) + '.' +
- Math.floor(Math.random() * 255);
-};
\ No newline at end of file
+ return Math.floor(Math.random() * 255) + '.'
+ + Math.floor(Math.random() * 255) + '.'
+ + Math.floor(Math.random() * 255) + '.'
+ + Math.floor(Math.random() * 255);
+}
diff --git a/index.test-d.ts b/index.test-d.ts
new file mode 100644
index 0000000..485c8b7
--- /dev/null
+++ b/index.test-d.ts
@@ -0,0 +1,4 @@
+import {expectType} from 'tsd';
+import ip from './index.js';
+
+expectType(ip());
diff --git a/package.json b/package.json
index 4982c20..e7a9cba 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@fakerjs/ip",
- "version": "2.0.1",
+ "version": "2.1.0",
"description": "IP package provides functionality to generate a fake ip value.",
"license": "MIT",
"repository": "faker-javascript/ip",
@@ -15,13 +15,17 @@
"node": ">=12"
},
"scripts": {
- "test": "ava"
+ "test": "c8 ava; xo --space 4; tsd;"
},
"devDependencies": {
- "ava": "^3.15.0"
+ "ava": "^4.0.0",
+ "c8": "^7.11.0",
+ "tsd": "^0.19.1",
+ "xo": "^0.47.0"
},
"files": [
- "index.js"
+ "index.js",
+ "index.d.ts"
],
"keywords": [
"fakerjs",
diff --git a/test.js b/test.js
index dc2018f..f6e7b63 100644
--- a/test.js
+++ b/test.js
@@ -1,7 +1,7 @@
-import ip from './index.js';
import test from 'ava';
+import ip from './index.js';
test('ip return type to be string', t => {
- t.is(typeof ip(), 'string');
+ t.is(typeof ip(), 'string');
});