From f814a7f8f2af059f8158f7e4b2bf8b46aeb62cd3 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 9 Jan 2022 22:40:45 -0800 Subject: [PATCH] [Dev Deps] backport from main --- .editorconfig | 15 ++++++++++++++- .eslintignore | 1 - .eslintrc | 24 +++++++++++++++++++++--- .gitignore | 3 +++ .npmignore | 18 ++++++++++++++---- .nycrc | 13 +++++++++++++ lib/stringify.js | 10 +++++----- lib/utils.js | 1 + package.json | 32 +++++++++++++++++--------------- test/.eslintrc | 15 --------------- test/parse.js | 2 +- 11 files changed, 89 insertions(+), 45 deletions(-) delete mode 100644 .eslintignore create mode 100644 .nycrc delete mode 100644 test/.eslintrc diff --git a/.editorconfig b/.editorconfig index b2654e7a..2f084445 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,11 +7,15 @@ end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -max_line_length = 140 +max_line_length = 160 +quote_type = single [test/*] max_line_length = off +[LICENSE.md] +indent_size = off + [*.md] max_line_length = off @@ -28,3 +32,12 @@ indent_size = 2 [LICENSE] indent_size = 2 max_line_length = off + +[coverage/**/*] +indent_size = off +indent_style = off +indent = off +max_line_length = off + +[.nycrc] +indent_style = tab diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 1521c8b7..00000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/.eslintrc b/.eslintrc index b7a87b93..3f848996 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,17 +3,35 @@ "extends": "@ljharb", + "ignorePatterns": [ + "dist/", + ], + "rules": { "complexity": 0, "consistent-return": 1, - "func-name-matching": 0, + "func-name-matching": 0, "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], "indent": [2, 4], + "max-lines-per-function": 0, "max-params": [2, 12], "max-statements": [2, 45], + "multiline-comment-style": 0, "no-continue": 1, "no-magic-numbers": 0, + "no-param-reassign": 1, "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], - "operator-linebreak": [2, "before"], - } + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": 0, + "max-statements": 0, + "no-extend-native": 0, + "function-paren-newline": 0, + }, + }, + ], } diff --git a/.gitignore b/.gitignore index 645ff13c..c036d926 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ dist/* yarn.lock package-lock.json npm-shrinkwrap.json + +.nyc_output/ +coverage/ diff --git a/.npmignore b/.npmignore index ac980d91..5fafe6be 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,14 @@ -bower.json -component.json -.npmignore -.travis.yml +# gitignore +npm-debug.log +node_modules +.DS_Store + +# Only apps should have lockfiles +yarn.lock +package-lock.json +npm-shrinkwrap.json + +.nyc_output/ +coverage/ + +.github/workflows diff --git a/.nycrc b/.nycrc new file mode 100644 index 00000000..1d57cabe --- /dev/null +++ b/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "dist" + ] +} diff --git a/lib/stringify.js b/lib/stringify.js index fb53ca07..0b21ca75 100644 --- a/lib/stringify.js +++ b/lib/stringify.js @@ -4,13 +4,13 @@ var utils = require('./utils'); var formats = require('./formats'); var arrayPrefixGenerators = { - brackets: function brackets(prefix) { // eslint-disable-line func-name-matching + brackets: function brackets(prefix) { return prefix + '[]'; }, - indices: function indices(prefix, key) { // eslint-disable-line func-name-matching + indices: function indices(prefix, key) { return prefix + '[' + key + ']'; }, - repeat: function repeat(prefix) { // eslint-disable-line func-name-matching + repeat: function repeat(prefix) { return prefix; } }; @@ -28,14 +28,14 @@ var defaults = { encode: true, encoder: utils.encode, encodeValuesOnly: false, - serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching + serializeDate: function serializeDate(date) { return toISO.call(date); }, skipNulls: false, strictNullHandling: false }; -var stringify = function stringify( // eslint-disable-line func-name-matching +var stringify = function stringify( object, prefix, generateArrayPrefix, diff --git a/lib/utils.js b/lib/utils.js index f42136ee..6592e206 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -159,6 +159,7 @@ var encode = function encode(str) { i += 1; c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + /* eslint operator-linebreak: [2, "before"] */ out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] diff --git a/package.json b/package.json index ed6ccf06..a3e8bda4 100644 --- a/package.json +++ b/package.json @@ -22,30 +22,32 @@ "engines": { "node": ">=0.6" }, - "dependencies": {}, "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "browserify": "^16.2.0", - "covert": "^1.1.0", - "editorconfig-tools": "^0.1.1", - "eslint": "^4.19.1", + "@ljharb/eslint-config": "^20.1.0", + "aud": "^1.1.5", + "browserify": "^16.5.2", + "eclint": "^2.8.1", + "eslint": "^8.6.0", "evalmd": "^0.0.17", - "iconv-lite": "^0.4.21", + "iconv-lite": "^0.4.24", + "in-publish": "^2.0.1", "mkdirp": "^0.5.1", + "nyc": "^10.3.2", "qs-iconv": "^1.0.4", - "safe-publish-latest": "^1.1.1", + "safe-publish-latest": "^2.0.0", "safer-buffer": "^2.1.2", - "tape": "^4.9.0" + "tape": "^5.4.0" }, "scripts": { - "prepublish": "safe-publish-latest && npm run dist", + "prepublishOnly": "safe-publish-latest && npm run dist", + "prepublish": "not-in-publish || npm run prepublishOnly", "pretest": "npm run --silent readme && npm run --silent lint", - "test": "npm run --silent coverage", - "tests-only": "node test", + "test": "npm run --silent tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "aud --production", "readme": "evalmd README.md", - "postlint": "editorconfig-tools check * lib/* test/*", - "lint": "eslint lib/*.js test/*.js", - "coverage": "covert test", + "postlint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js" }, "license": "BSD-3-Clause" diff --git a/test/.eslintrc b/test/.eslintrc deleted file mode 100644 index 20175d64..00000000 --- a/test/.eslintrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "rules": { - "array-bracket-newline": 0, - "array-element-newline": 0, - "consistent-return": 2, - "max-lines": 0, - "max-nested-callbacks": [2, 3], - "max-statements": 0, - "no-buffer-constructor": 0, - "no-extend-native": 0, - "no-magic-numbers": 0, - "object-curly-newline": 0, - "sort-keys": 0 - } -} diff --git a/test/parse.js b/test/parse.js index ce014d42..7614a287 100644 --- a/test/parse.js +++ b/test/parse.js @@ -523,7 +523,7 @@ test('parse()', function (t) { st.deepEqual( qs.parse('a[b]=c&a=toString', { plainObjects: true }), - { a: { b: 'c', toString: true } }, + { __proto__: null, a: { __proto__: null, b: 'c', toString: true } }, 'can overwrite prototype with plainObjects true' );