diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..1b24c0ca6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = lf diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index 49f148384..1a186bd7f 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -39,6 +39,9 @@ jobs: - name: Run jshint run: npm run jshint + - name: Run fmt + run: npm run fmt + - name: Run tests run: npm run test diff --git a/.jshintrc b/.jshintrc index df33758a7..d570493ad 100644 --- a/.jshintrc +++ b/.jshintrc @@ -8,35 +8,30 @@ "eqeqeq": true, "freeze": true, "immed": true, - "indent": 2, "latedef": "nofunc", + "laxbreak": true, "newcap": false, "noarg": true, "node": true, "noempty": true, "nonew": true, - "quotmark": "single", "regexp": true, - "smarttabs": false, "strict": true, - "trailing": true, "undef": true, "unused": true, "maxparams": 5, "maxstatements": 17, "maxcomplexity": 10, "maxdepth": 3, - "maxlen": 120, - "multistr": true, "predef": [ - "after", - "afterEach", - "before", - "beforeEach", - "describe", - "exports", - "it", - "module", - "require" + "after", + "afterEach", + "before", + "beforeEach", + "describe", + "exports", + "it", + "module", + "require" ] } diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..963354f23 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "printWidth": 120 +} diff --git a/package.json b/package.json index f2fc83485..bef7b92c9 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ }, "scripts": { "test": "mocha -R spec --recursive", + "fmt": "npx -p prettier@2.x -- prettier -w '**/*.{js,md}'", "regtest": "./regtest/regtest", "jshint": "jshint --reporter=node_modules/jshint-stylish ./lib", "coverage": "istanbul cover _mocha -- --recursive",