From 393c089534cf252661fd0bfb40b7c783193059b6 Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Sat, 9 May 2020 22:02:44 +0900 Subject: [PATCH 1/5] Use eslint recommended config instead of Airbnb --- .eslintrc.yml | 13 +++---------- package.json | 1 - yarn.lock | 24 ------------------------ 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 930bb798..1bb704d8 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,9 +1,10 @@ env: - node: true es6: true + node: true extends: - - airbnb-base + - eslint:recommended + - plugin:import/recommended - prettier parser: babel-eslint @@ -18,11 +19,3 @@ rules: ignoreRegExpLiterals: true ignoreStrings: true ignoreTemplateLiterals: true - - no-param-reassign: off - - no-restricted-syntax: - - error - - ForInStatement - - LabeledStatement - - WithStatement diff --git a/package.json b/package.json index 31ff49b0..f649e796 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,6 @@ "dedent": "^0.7.0", "docsify-themeable": "^0.8.1", "eslint": "^7.0.0", - "eslint-config-airbnb-base": "14.1.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-import": "^2.20.2", "jest": "^26.0.1", diff --git a/yarn.lock b/yarn.lock index 51fd99dd..826d29b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1955,11 +1955,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -confusing-browser-globals@^1.0.9: - version "1.0.9" - resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz#72bc13b483c0276801681871d4898516f8f54fdd" - integrity sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw== - contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" @@ -2494,15 +2489,6 @@ escodegen@^1.14.1: optionalDependencies: source-map "~0.6.1" -eslint-config-airbnb-base@14.1.0: - version "14.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.1.0.tgz#2ba4592dd6843258221d9bff2b6831bd77c874e4" - integrity sha512-+XCcfGyCnbzOnktDVhwsCAx+9DmrzEmuwxyHUJpw+kqBVT744OUBrB09khgFKlK1lshVww6qXGsYPZpavoNjJw== - dependencies: - confusing-browser-globals "^1.0.9" - object.assign "^4.1.0" - object.entries "^1.1.1" - eslint-config-prettier@^6.11.0: version "6.11.0" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1" @@ -4867,16 +4853,6 @@ object.assign@^4.1.0: has-symbols "^1.0.0" object-keys "^1.0.11" -object.entries@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.1.tgz#ee1cf04153de02bb093fec33683900f57ce5399b" - integrity sha512-ilqR7BgdyZetJutmDPfXCDffGa0/Yzl2ivVNpbx/g4UeWrCdRnFDUBrKJGLhGieRHDATnyZXWBeCb29k9CJysQ== - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - function-bind "^1.1.1" - has "^1.0.3" - object.getownpropertydescriptors@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz#369bf1f9592d8ab89d712dced5cb81c7c5352649" From 67e09176cddf2eab03d6ff81fd19458ede2fa622 Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Sat, 9 May 2020 22:06:48 +0900 Subject: [PATCH 2/5] Enable --report-unused-disable-directives flag for ESLint --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f649e796..c960c14b 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "docs:style": "node ./docsify/build.js", "format": "prettier \"**/*.{css,html,js,json,md,scss,ts,yaml,yml}\"", "jsdoc": "rimraf jsdoc && jsdoc src -c .jsdoc.json", - "lint:js": "eslint .", + "lint:js": "eslint --report-unused-disable-directives .", "lint:css": "stylelint \"./**/*.{css,scss}\"", "prepack": "npm-run-all --parallel check:* lint:* test:coverage --sequential build", "preversion": "run-p check:* lint:* test:coverage", From 6bbd4a0e7f56e73cb1841cfcf51582af7a358a67 Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Sat, 9 May 2020 22:07:42 +0900 Subject: [PATCH 3/5] Enable import/order rule --- .eslintrc.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.eslintrc.yml b/.eslintrc.yml index 1bb704d8..468a7466 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -10,6 +10,11 @@ extends: parser: babel-eslint rules: + import/order: + - error + - alphabetize: + order: 'asc' + max-len: - error - 80 From ab71f1cd0bb01393f218dc723d4780cc393f0622 Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Sat, 9 May 2020 22:09:01 +0900 Subject: [PATCH 4/5] Fix import order --- src/markdown/background_image/advanced.js | 2 +- src/markdown/comment.js | 2 +- src/markdown/container.js | 2 +- src/markdown/directives/apply.js | 4 ++-- src/markdown/directives/parse.js | 6 +++--- src/markdown/header_and_footer.js | 2 +- src/markdown/heading_divider.js | 2 +- src/markdown/image/apply.js | 2 +- src/markdown/image/parse.js | 1 - src/markdown/inline_svg.js | 2 +- src/markdown/slide.js | 2 +- src/markdown/slide_container.js | 2 +- src/marpit.js | 10 +++++----- test/markdown/background_image.js | 4 ++-- test/markdown/collect.js | 6 +++--- test/markdown/directives/apply.js | 2 +- test/markdown/header_and_footer.js | 4 ++-- test/markdown/heading_divider.js | 2 +- test/markdown/image.js | 4 ++-- test/markdown/inline_svg.js | 4 ++-- test/markdown/style/assign.js | 2 +- test/markdown/sweep.js | 4 ++-- test/marpit.js | 2 +- test/postcss/printable.js | 2 +- test/postcss/pseudo_selector/replace.js | 2 +- test/postcss/root/rem.js | 2 +- test/postcss/root/replace.js | 4 ++-- test/theme.js | 2 +- test/theme_set.js | 2 +- 29 files changed, 43 insertions(+), 44 deletions(-) diff --git a/src/markdown/background_image/advanced.js b/src/markdown/background_image/advanced.js index f793e5d7..0dd80392 100644 --- a/src/markdown/background_image/advanced.js +++ b/src/markdown/background_image/advanced.js @@ -1,7 +1,7 @@ /** @module */ -import marpitPlugin from '../../plugin' import InlineStyle from '../../helpers/inline_style' import wrapTokens from '../../helpers/wrap_tokens' +import marpitPlugin from '../../plugin' /** * Marpit advanced background image plugin. diff --git a/src/markdown/comment.js b/src/markdown/comment.js index 5b3a0458..a5700634 100644 --- a/src/markdown/comment.js +++ b/src/markdown/comment.js @@ -1,6 +1,6 @@ /** @module */ -import yaml from './directives/yaml' import marpitPlugin from '../plugin' +import yaml from './directives/yaml' const commentMatcher = /