n2words 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +13 -29
  3. package/lib/classes/{AbstractLanguage.mjs → AbstractLanguage.js} +2 -2
  4. package/lib/classes/{BaseLanguage.mjs → BaseLanguage.js} +3 -3
  5. package/lib/i18n/{AR.mjs → AR.js} +1 -1
  6. package/lib/i18n/{AZ.mjs → AZ.js} +1 -1
  7. package/lib/i18n/{CZ.mjs → CZ.js} +1 -1
  8. package/lib/i18n/{DE.mjs → DE.js} +1 -1
  9. package/lib/i18n/{DK.mjs → DK.js} +1 -1
  10. package/lib/i18n/{EN.mjs → EN.js} +1 -1
  11. package/lib/i18n/{ES.mjs → ES.js} +1 -1
  12. package/lib/i18n/{FA.mjs → FA.js} +1 -1
  13. package/lib/i18n/{FR.mjs → FR.js} +1 -1
  14. package/lib/i18n/{HE.mjs → HE.js} +1 -1
  15. package/lib/i18n/{HR.mjs → HR.js} +1 -1
  16. package/lib/i18n/{HU.mjs → HU.js} +1 -1
  17. package/lib/i18n/{ID.mjs → ID.js} +1 -1
  18. package/lib/i18n/{IT.mjs → IT.js} +1 -1
  19. package/lib/i18n/{KO.mjs → KO.js} +1 -1
  20. package/lib/i18n/{LT.mjs → LT.js} +1 -1
  21. package/lib/i18n/{LV.mjs → LV.js} +1 -1
  22. package/lib/i18n/{NL.mjs → NL.js} +1 -1
  23. package/lib/i18n/{NO.mjs → NO.js} +1 -1
  24. package/lib/i18n/{PL.mjs → PL.js} +1 -1
  25. package/lib/i18n/{PT.mjs → PT.js} +1 -1
  26. package/lib/i18n/{RU.mjs → RU.js} +1 -1
  27. package/lib/i18n/{SR.mjs → SR.js} +1 -1
  28. package/lib/i18n/{TR.mjs → TR.js} +1 -1
  29. package/lib/i18n/{UK.mjs → UK.js} +1 -1
  30. package/lib/i18n/{VI.mjs → VI.js} +1 -1
  31. package/lib/i18n/{ZH.mjs → ZH.js} +1 -1
  32. package/lib/{n2words.mjs → n2words.js} +28 -28
  33. package/package.json +44 -36
  34. package/.editorconfig +0 -13
  35. package/.eslintrc.json +0 -105
  36. package/.gitattributes +0 -5
  37. package/bench.mjs +0 -94
  38. package/dist/n2words.js +0 -1
  39. package/examples/node.mjs +0 -10
  40. package/webpack.config.js +0 -31
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 Wael TELLAT
3
+ Copyright (c) 2018-2023 Wael TELLAT
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -4,12 +4,11 @@
4
4
  [![Coverage Status](https://coveralls.io/repos/github/forzagreen/n2words/badge.svg?branch=master)](https://coveralls.io/github/forzagreen/n2words?branch=master)
5
5
  [![npm](https://img.shields.io/npm/v/n2words.svg)](https://npmjs.com/package/n2words)
6
6
  [![npm](https://img.shields.io/npm/dw/n2words)](https://npmjs.com/package/n2words)
7
+ [![](https://data.jsdelivr.com/v1/package/npm/n2words/badge)](https://www.jsdelivr.com/package/npm/n2words)
7
8
 
8
- n2words is a library that converts a numerical number into a written number.
9
+ __n2words__ converts a numerical number into a written one, supports [27 languages](https://github.com/forzagreen/n2words#supported-languages), and has zero dependencies.
9
10
 
10
- We have support for multiple languages (27 and growing) and our package is lightweight, modular and has no dependencies.
11
-
12
- ## How To
11
+ ## Example
13
12
 
14
13
  ```js
15
14
  n2words(123) // 'one hundred and twenty-three'
@@ -20,6 +19,8 @@ n2words(123, {lang: 'es'}) // 'ciento veintitrés'
20
19
  n2words(123, {lang: 'ar'}) // 'مائة و ثلاثة و عشرون'
21
20
  ```
22
21
 
22
+ See the [Wiki](https://github.com/forzagreen/n2words/wiki) for examples and advanced usage.
23
+
23
24
  ## Install
24
25
 
25
26
  ```sh
@@ -34,42 +35,28 @@ n2words is also available on [jsDelivr](https://jsdelivr.com/package/npm/n2words
34
35
 
35
36
  ```js
36
37
  import n2words from 'n2words'
37
-
38
- // Source file
39
- import n2words from 'n2words/lib/n2words.mjs'
40
-
41
- // Individual languages (recommended)
42
- import n2wordsEN from 'n2words/lib/i18n/EN.mjs'
43
38
  ```
44
39
 
45
40
  ### CommonJS
46
41
 
47
42
  ```js
48
- var n2words = require('n2words')
49
-
50
- // Dynamic Import (source files)
51
- import('n2words/lib/n2words.mjs').then(n2words => {
43
+ // Dynamic Import
44
+ import('n2words').then(n2words => {
52
45
  // Available via "default" method
53
46
  n2words.default(100)
54
47
  })
55
-
56
- // Individual languages
57
- import('n2words/lib/i18n/EN.mjs').then(n2wordsEN => {
58
- n2wordsEN.default(100)
59
- })
60
48
  ```
61
49
 
62
50
  ### Browser
63
51
 
64
52
  ```html
65
53
  <script src="n2words.js"></script>
54
+ <script>
55
+ n2words(100)
56
+ </script>
66
57
  ```
67
58
 
68
- ## Features
69
-
70
- - Cardinal numbers
71
- - Decimal numbers
72
- - Negative numbers
59
+ You can also [import only specific languages](https://github.com/forzagreen/n2words/wiki/Importing-only-specific-languages) if you don't need all of them.
73
60
 
74
61
  ## Supported Languages
75
62
 
@@ -103,10 +90,7 @@ import('n2words/lib/i18n/EN.mjs').then(n2wordsEN => {
103
90
 
104
91
  ## Contributing
105
92
 
106
- You can help by adding new languages or by improving existing ones. Also, reporting issues, verifying the correctness of unit tests or adding more test cases is extremely helpful.
107
-
108
- All help is welcome!
109
-
93
+ __This library is in active development.__ We are looking to improve the design and process for language contributors as well as add more languages.
110
94
  ## License
111
95
 
112
- MIT
96
+ [MIT](https://github.com/forzagreen/n2words/blob/master/LICENSE)
@@ -11,10 +11,10 @@ export default class {
11
11
 
12
12
  /**
13
13
  * @param {object} options Options for class.
14
- * @param {string} [options.negativeWord = ''] Word that precedes a negative number (if any).
14
+ * @param {string} [options.negativeWord] Word that precedes a negative number (if any).
15
15
  * @param {string} options.separatorWord Word that separates cardinal numbers (i.e. "and").
16
16
  * @param {string} options.zero Word for 0 (i.e. "zero").
17
- * @param {string} [options.spaceSeparator = ' '] Character that separates words.
17
+ * @param {string} [options.spaceSeparator] Character that separates words.
18
18
  */
19
19
  constructor(options) {
20
20
  // Merge supplied options with defaults
@@ -1,4 +1,4 @@
1
- import AbstractLanguage from './AbstractLanguage.mjs';
1
+ import AbstractLanguage from './AbstractLanguage.js';
2
2
 
3
3
  /**
4
4
  * Creates new common language class that uses a highest matching word value algorithm.
@@ -11,10 +11,10 @@ export default class extends AbstractLanguage {
11
11
 
12
12
  /**
13
13
  * @param {object} options Options for class.
14
- * @param {string} [options.negativeWord = ''] Word that precedes a negative number (if any).
14
+ * @param {string} [options.negativeWord] Word that precedes a negative number (if any).
15
15
  * @param {string} options.separatorWord Word that separates cardinal numbers (i.e. "and").
16
16
  * @param {string} options.zero Word for 0 (i.e. "zero").
17
- * @param {string} [options.spaceSeparator = ' '] Character that separates words.
17
+ * @param {string} [options.spaceSeparator] Character that separates words.
18
18
  * @param {Array} cards Array of number matching "cards" from highest-to-lowest.
19
19
  */
20
20
  constructor(options, cards) {
@@ -1,4 +1,4 @@
1
- import AbstractLanguage from '../classes/AbstractLanguage.mjs';
1
+ import AbstractLanguage from '../classes/AbstractLanguage.js';
2
2
 
3
3
  export class Arabic extends AbstractLanguage {
4
4
  integerValue = 0;
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsAZ extends BaseLanguage {
4
4
  constructor(options) {
@@ -1,4 +1,4 @@
1
- import {N2WordsRU} from './RU.mjs';
1
+ import {N2WordsRU} from './RU.js';
2
2
 
3
3
  export class N2WordsCZ extends N2WordsRU {
4
4
  ones = {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsDE extends BaseLanguage {
4
4
  constructor(options) {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsDK extends BaseLanguage {
4
4
  ordFlag;
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  /**
4
4
  * This class is for converting numbers to english words.
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsES extends BaseLanguage {
4
4
  genderStem;
@@ -1,4 +1,4 @@
1
- import AbstractLanguage from '../classes/AbstractLanguage.mjs';
1
+ import AbstractLanguage from '../classes/AbstractLanguage.js';
2
2
 
3
3
  export class N2WordsFA extends AbstractLanguage {
4
4
  namedNumbers = {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsFR extends BaseLanguage {
4
4
  constructor(options) {
@@ -1,4 +1,4 @@
1
- import {N2WordsRU} from './RU.mjs';
1
+ import {N2WordsRU} from './RU.js';
2
2
 
3
3
  export class N2WordsHE extends N2WordsRU {
4
4
  and;
@@ -1,4 +1,4 @@
1
- import {N2WordsRU} from './RU.mjs';
1
+ import {N2WordsRU} from './RU.js';
2
2
 
3
3
  export class N2WordsHR extends N2WordsRU {
4
4
  ones = {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsHU extends BaseLanguage {
4
4
  constructor(options) {
@@ -1,4 +1,4 @@
1
- import AbstractLanguage from '../classes/AbstractLanguage.mjs';
1
+ import AbstractLanguage from '../classes/AbstractLanguage.js';
2
2
 
3
3
  export class N2WordsID extends AbstractLanguage {
4
4
  base = {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsIT extends BaseLanguage {
4
4
  cardinalWords = [
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsKO extends BaseLanguage {
4
4
  constructor(options) {
@@ -1,4 +1,4 @@
1
- import {N2WordsRU} from './RU.mjs';
1
+ import {N2WordsRU} from './RU.js';
2
2
 
3
3
  export class N2WordsLT extends N2WordsRU {
4
4
  ones = {
@@ -1,4 +1,4 @@
1
- import {N2WordsRU} from './RU.mjs';
1
+ import {N2WordsRU} from './RU.js';
2
2
 
3
3
  export class N2WordsLV extends N2WordsRU{
4
4
  ones = {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsNL extends BaseLanguage {
4
4
  includeOptionalAnd;
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsNO extends BaseLanguage {
4
4
  constructor(options) {
@@ -1,4 +1,4 @@
1
- import {N2WordsRU} from './RU.mjs';
1
+ import {N2WordsRU} from './RU.js';
2
2
 
3
3
  export class N2WordsPL extends N2WordsRU {
4
4
  ones = {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsPT extends BaseLanguage {
4
4
  hundreds = {
@@ -1,4 +1,4 @@
1
- import AbstractLanguage from '../classes/AbstractLanguage.mjs';
1
+ import AbstractLanguage from '../classes/AbstractLanguage.js';
2
2
 
3
3
  export class N2WordsRU extends AbstractLanguage {
4
4
  feminine;
@@ -1,4 +1,4 @@
1
- import {N2WordsRU} from './RU.mjs';
1
+ import {N2WordsRU} from './RU.js';
2
2
 
3
3
  export class N2WordsSR extends N2WordsRU {
4
4
  ones = {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsTR extends BaseLanguage {
4
4
  constructor(options = {}) {
@@ -1,4 +1,4 @@
1
- import {N2WordsRU} from './RU.mjs';
1
+ import {N2WordsRU} from './RU.js';
2
2
 
3
3
  export class N2WordsUK extends N2WordsRU {
4
4
  ones = {
@@ -1,4 +1,4 @@
1
- import AbstractLanguage from '../classes/AbstractLanguage.mjs';
1
+ import AbstractLanguage from '../classes/AbstractLanguage.js';
2
2
 
3
3
  export class N2WordsID extends AbstractLanguage {
4
4
  base = {
@@ -1,4 +1,4 @@
1
- import BaseLanguage from '../classes/BaseLanguage.mjs';
1
+ import BaseLanguage from '../classes/BaseLanguage.js';
2
2
 
3
3
  export class N2WordsZH extends BaseLanguage {
4
4
  constructor(options) {
@@ -1,36 +1,36 @@
1
1
  /* eslint-disable import/max-dependencies */
2
- import n2wordsAR from './i18n/AR.mjs';
3
- import n2wordsAZ from './i18n/AZ.mjs';
4
- import n2wordsCZ from './i18n/CZ.mjs';
5
- import n2wordsDE from './i18n/DE.mjs';
6
- import n2wordsDK from './i18n/DK.mjs';
7
- import n2wordsEN from './i18n/EN.mjs';
8
- import n2wordsES from './i18n/ES.mjs';
9
- import n2wordsFA from './i18n/FA.mjs';
10
- import n2wordsFR from './i18n/FR.mjs';
11
- import n2wordsHE from './i18n/HE.mjs';
12
- import n2wordsHR from './i18n/HR.mjs';
13
- import n2wordsHU from './i18n/HU.mjs';
14
- import n2wordsID from './i18n/ID.mjs';
15
- import n2wordsIT from './i18n/IT.mjs';
16
- import n2wordsKO from './i18n/KO.mjs';
17
- import n2wordsLT from './i18n/LT.mjs';
18
- import n2wordsLV from './i18n/LV.mjs';
19
- import n2wordsNL from './i18n/NL.mjs';
20
- import n2wordsNO from './i18n/NO.mjs';
21
- import n2wordsPL from './i18n/PL.mjs';
22
- import n2wordsPT from './i18n/PT.mjs';
23
- import n2wordsRU from './i18n/RU.mjs';
24
- import n2wordsSR from './i18n/SR.mjs';
25
- import n2wordsTR from './i18n/TR.mjs';
26
- import n2wordsUK from './i18n/UK.mjs';
27
- import n2wordsVI from './i18n/VI.mjs';
28
- import n2wordsZH from './i18n/ZH.mjs';
2
+ import n2wordsAR from './i18n/AR.js';
3
+ import n2wordsAZ from './i18n/AZ.js';
4
+ import n2wordsCZ from './i18n/CZ.js';
5
+ import n2wordsDE from './i18n/DE.js';
6
+ import n2wordsDK from './i18n/DK.js';
7
+ import n2wordsEN from './i18n/EN.js';
8
+ import n2wordsES from './i18n/ES.js';
9
+ import n2wordsFA from './i18n/FA.js';
10
+ import n2wordsFR from './i18n/FR.js';
11
+ import n2wordsHE from './i18n/HE.js';
12
+ import n2wordsHR from './i18n/HR.js';
13
+ import n2wordsHU from './i18n/HU.js';
14
+ import n2wordsID from './i18n/ID.js';
15
+ import n2wordsIT from './i18n/IT.js';
16
+ import n2wordsKO from './i18n/KO.js';
17
+ import n2wordsLT from './i18n/LT.js';
18
+ import n2wordsLV from './i18n/LV.js';
19
+ import n2wordsNL from './i18n/NL.js';
20
+ import n2wordsNO from './i18n/NO.js';
21
+ import n2wordsPL from './i18n/PL.js';
22
+ import n2wordsPT from './i18n/PT.js';
23
+ import n2wordsRU from './i18n/RU.js';
24
+ import n2wordsSR from './i18n/SR.js';
25
+ import n2wordsTR from './i18n/TR.js';
26
+ import n2wordsUK from './i18n/UK.js';
27
+ import n2wordsVI from './i18n/VI.js';
28
+ import n2wordsZH from './i18n/ZH.js';
29
29
 
30
30
  /**
31
31
  * Converts a number to written form.
32
32
  * @param {number|string} value The number to convert.
33
- * @param {object} [options = {lang: en}] User options.
33
+ * @param {object} [options] User options.
34
34
  * @returns {string} Value in written format.
35
35
  */
36
36
  export default function(value, options = {lang: 'en'}) {
package/package.json CHANGED
@@ -1,22 +1,7 @@
1
1
  {
2
2
  "name": "n2words",
3
- "version": "1.15.0",
4
- "description": "Convert numbers to words, in multiple languages",
5
- "main": "dist/n2words.js",
6
- "scripts": {
7
- "lint": "eslint --config .eslintrc.json lib/ test/",
8
- "test": "ava --verbose",
9
- "coverage": "c8 ava",
10
- "build": "webpack --config webpack.config.js --progress",
11
- "bench": "node bench.mjs"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/forzagreen/n2words.git"
16
- },
17
- "engines": {
18
- "node": "16 || >=18"
19
- },
3
+ "version": "1.16.0",
4
+ "description": "n2words converts a numerical number into a written one, supports 27 languages and has zero dependencies.",
20
5
  "keywords": [
21
6
  "n2words",
22
7
  "convert",
@@ -54,28 +39,31 @@
54
39
  "vietnamese",
55
40
  "azerbaijani"
56
41
  ],
57
- "author": "Wael TELLAT",
58
- "license": "MIT",
42
+ "homepage": "https://github.com/forzagreen/n2words#readme",
59
43
  "bugs": {
60
44
  "url": "https://github.com/forzagreen/n2words/issues"
61
45
  },
62
- "homepage": "https://github.com/forzagreen/n2words#readme",
63
- "devDependencies": {
64
- "@babel/core": "^7.22.1",
65
- "@babel/preset-env": "^7.22.4",
66
- "ava": "^5.3.0",
67
- "babel-loader": "^9.1.2",
68
- "benchmark": "^2.1.4",
69
- "c8": "^7.14.0",
70
- "core-js": "^3.30.2",
71
- "eslint": "^8.41.0",
72
- "eslint-plugin-ava": "^14.0.0",
73
- "eslint-plugin-import": "^2.27.5",
74
- "eslint-plugin-jsdoc": "^45.0.0",
75
- "eslint-plugin-node": "^11.1.0",
76
- "microtime": "^3.1.1",
77
- "webpack": "^5.84.1",
78
- "webpack-cli": "^5.1.1"
46
+ "repository": "github:forzagreen/n2words",
47
+ "license": "MIT",
48
+ "author": "Wael TELLAT",
49
+ "contributors": [
50
+ "Tyler Vigario <TylerVigario90@gmail.com>"
51
+ ],
52
+ "type": "module",
53
+ "exports": {
54
+ ".": "./lib/n2words.js",
55
+ "./i18n/": "./lib/i18n/"
56
+ },
57
+ "files": [
58
+ "lib/*",
59
+ "build/*"
60
+ ],
61
+ "scripts": {
62
+ "bench": "node bench.js",
63
+ "build": "webpack --config webpack.config.js --progress",
64
+ "coverage": "c8 ava",
65
+ "lint": "eslint --config .eslintrc.json lib/ test/",
66
+ "test": "ava --verbose"
79
67
  },
80
68
  "ava": {
81
69
  "files": [
@@ -92,5 +80,25 @@
92
80
  "lcov",
93
81
  "text"
94
82
  ]
83
+ },
84
+ "devDependencies": {
85
+ "@babel/core": "^7.22.1",
86
+ "@babel/preset-env": "^7.22.4",
87
+ "ava": "^5.3.0",
88
+ "babel-loader": "^9.1.2",
89
+ "benchmark": "^2.1.4",
90
+ "c8": "^7.14.0",
91
+ "core-js": "^3.30.2",
92
+ "eslint": "^8.41.0",
93
+ "eslint-plugin-ava": "^14.0.0",
94
+ "eslint-plugin-import": "^2.27.5",
95
+ "eslint-plugin-jsdoc": "^46.0.0",
96
+ "eslint-plugin-node": "^11.1.0",
97
+ "microtime": "^3.1.1",
98
+ "webpack": "^5.84.1",
99
+ "webpack-cli": "^5.1.1"
100
+ },
101
+ "engines": {
102
+ "node": "16 || >=18"
95
103
  }
96
104
  }
package/.editorconfig DELETED
@@ -1,13 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- indent_size = 2
6
- tab_width = 2
7
- indent_style = space
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
10
- quote_type = single
11
-
12
- [*.json]
13
- quote_type = double
package/.eslintrc.json DELETED
@@ -1,105 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "commonjs": true,
5
- "es6": true,
6
- "es2017": true,
7
- "es2020": true,
8
- "es2021": true,
9
- "es2022": true,
10
- "node": true
11
- },
12
- "plugins": [
13
- "ava",
14
- "node",
15
- "import",
16
- "jsdoc"
17
- ],
18
- "extends": [
19
- "eslint:recommended",
20
- "plugin:ava/recommended",
21
- "plugin:node/recommended",
22
- "plugin:import/errors",
23
- "plugin:import/warnings",
24
- "plugin:jsdoc/recommended"
25
- ],
26
- "overrides": [{
27
- "files": ["*.js", "*.mjs"]
28
- }],
29
- "parserOptions": {
30
- "ecmaVersion": "latest",
31
- "sourceType": "module"
32
- },
33
- "rules": {
34
- // Ignore platform dependent linebreak
35
- "linebreak-style": "off",
36
- // Remove maximum length limit
37
- "max-len": "off",
38
- // Enforce camelCase for variable names
39
- "camelcase": ["error", {
40
- "properties": "never"
41
- }],
42
- // Enforce indent of two spaces
43
- "indent": [
44
- "error", 2, {
45
- "SwitchCase": 1
46
- }
47
- ],
48
- // Remove trailing whitespace
49
- "no-trailing-spaces": "error",
50
- // Enforce use of single quotes
51
- "quotes": ["error", "single"],
52
- // Enforce use of semicolon to end lines
53
- "semi": "error",
54
- // Enforce consistent spacing before & after arrow function
55
- "arrow-spacing": "error",
56
- // Enforce omitting parentheses when unnecessary for arrow functions
57
- "arrow-parens": ["error", "as-needed"],
58
- // Disallow multiple imports of same module
59
- "no-duplicate-imports": "error",
60
- // Enforce let or const instead of var
61
- "no-var": "error",
62
- // Enforce consistent brace style usage (1TBS default)
63
- "brace-style": "error",
64
- //
65
- // -- IMPORT RULES --
66
- //
67
- // Report any invalid exports, i.e. re-export of the same name
68
- "import/export": "error",
69
- // Report modules without exports, or exports without matching import in another module
70
- "import/no-unused-modules": "error",
71
- // Report potentially ambiguous parse goal (script vs. module)
72
- "import/unambiguous": "error",
73
- // Report CommonJS require calls and module.exports or exports.*
74
- "import/no-commonjs": "error",
75
- // Report AMD require and define calls
76
- "import/no-amd": "error",
77
- // No Node.js builtin modules
78
- "import/no-nodejs-modules": "error",
79
- // Report imported names marked with @deprecated documentation tag
80
- "import/no-deprecated": "error",
81
- // Ensure all imports appear before other statements
82
- "import/first": "error",
83
- // Ensure consistent use of file extension within the import path
84
- "import/extensions": ["error", "always"],
85
- // Enforce a newline after import statements
86
- "import/newline-after-import": "error",
87
- // Ensure imports point to a file/module that can be resolved
88
- "import/no-unresolved": ["error", {
89
- "commonjs": true
90
- }],
91
- // Limit the maximum number of dependencies a module can have
92
- "import/max-dependencies": "error",
93
- // Prefer a default export if module exports a single name
94
- "import/prefer-default-export": "error",
95
- // Forbid unassigned imports
96
- "import/no-unassigned-import": ["error", {
97
- "allow": ["**/app.mjs"]
98
- }]
99
- //
100
- // -- JSDOC RULES --
101
- //
102
- // Checks for presence of jsdoc comments, on class declarations as well as functions
103
- //"jsdoc/require-jsdoc": "off"
104
- }
105
- }
package/.gitattributes DELETED
@@ -1,5 +0,0 @@
1
- # Automatically convert to native line endings
2
- * text=auto
3
-
4
- # Force Unix (LF) line endings
5
- package-lock.json text eol=lf