From 02d5325a317e1046b54f74de470fd791c8effa97 Mon Sep 17 00:00:00 2001 From: Alan Palazzolo Date: Thu, 3 Jan 2019 15:04:33 -0600 Subject: [PATCH 1/6] Adding eslint and packages and adding lint npm scripts. --- .eslintrc.json | 7 +++++++ package.json | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..2fa798b --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,7 @@ +{ + "extends": ["eslint:recommended", "plugin:es5/no-es2015"], + "rules": { + "semi": ["error", "always"], + "quotes": ["error", "double"] + } +} diff --git a/package.json b/package.json index 357c28a..314fec1 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,12 @@ "name": "ai2html", "version": "0.81.4", "description": "A script for Adobe Illustrator that converts your Illustrator artwork into an html page.", -"main": "./ai2html.js", -"scripts": { + "main": "./ai2html.js", + "scripts": { "test": "mocha --check-leaks", - "prepublishOnly": "./prepublish.sh" + "prepublishOnly": "./prepublish.sh", + "lint": "eslint ai2html*.js test/**/*js", + "lintFix": "eslint ai2html*.js test/**/*js --fix" }, "repository": { "type": "git", @@ -17,6 +19,8 @@ "url": "https://github.com/newsdev/ai2html/issues" }, "devDependencies": { + "eslint": "^5.11.1", + "eslint-plugin-es5": "^1.3.1", "mocha": ">=3.2.0" }, "homepage": "https://github.com/newsdev/ai2html#readme" From eb73b05640bfceae17f443c39a68859dc75014ad Mon Sep 17 00:00:00 2001 From: Alan Palazzolo Date: Thu, 3 Jan 2019 15:21:27 -0600 Subject: [PATCH 2/6] Comment about globals from illustrator. --- ai2html.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ai2html.js b/ai2html.js index 861de40..d582bfa 100644 --- a/ai2html.js +++ b/ai2html.js @@ -32,6 +32,9 @@ // - Go to the folder containing your Illustrator file. Inside will be a folder called ai2html-output. // - Open the html files in your browser to preview your output. +// Globals available from Illustrator +// https://www.adobe.com/devnet/illustrator/scripting.html + function main() { // Enclosing scripts in a named function (and not an anonymous, self-executing // function) has been recommended as a way to minimise intermittent "MRAP" errors. From 3dca20d8191bd9c423130189044790bd085514d5 Mon Sep 17 00:00:00 2001 From: Alan Palazzolo Date: Thu, 3 Jan 2019 15:21:43 -0600 Subject: [PATCH 3/6] Globals for linting. --- .eslintrc.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 2fa798b..1d91db6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,37 @@ { "extends": ["eslint:recommended", "plugin:es5/no-es2015"], + "env": { + "browser": true, + "node": true +}, "rules": { "semi": ["error", "always"], "quotes": ["error", "double"] + }, + "globals": { + "app": true, + "alert": true, + "confirm": true, + "Folder": true, + "File": true, + "DocumentColorspace": true, + "IllustratorSaveOptions": true, + "ZOrderMethod": true, + "TextType": true, + "Window": true, + "BlendModes": true, + "ElementPlacement": true, + "PointType": true, + "ExportType": true, + "ExportOptionsPNG8": true, + "ExportOptionsPNG24": true, + "ExportOptionsJPEG": true, + "SVGFontSubsetting": true, + "SVGDocumentEncoding": true, + "SVGDTDVersion": true, + "SVGCSSPropertyLocation": true, + "SaveOptions": true, + "Event": true, + "$": true } } From d5c6c776de82ac8282fe9aeea5d9059632e12a75 Mon Sep 17 00:00:00 2001 From: Alan Palazzolo Date: Thu, 3 Jan 2019 15:24:15 -0600 Subject: [PATCH 4/6] Don't worry about legacy. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 314fec1..7f2bc8e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "mocha --check-leaks", "prepublishOnly": "./prepublish.sh", "lint": "eslint ai2html*.js test/**/*js", - "lintFix": "eslint ai2html*.js test/**/*js --fix" + "lintFix": "eslint ai2html.js test/**/*js --fix" }, "repository": { "type": "git", From 363e836b3392c5c832b05f85fe3197235fc247ca Mon Sep 17 00:00:00 2001 From: Alan Palazzolo Date: Thu, 3 Jan 2019 15:24:32 -0600 Subject: [PATCH 5/6] Add globals to config. --- .eslintrc.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 1d91db6..2074ceb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,7 +14,7 @@ "confirm": true, "Folder": true, "File": true, - "DocumentColorspace": true, + "DocumentColorSpace": true, "IllustratorSaveOptions": true, "ZOrderMethod": true, "TextType": true, @@ -26,12 +26,15 @@ "ExportOptionsPNG8": true, "ExportOptionsPNG24": true, "ExportOptionsJPEG": true, + "ExportOptionsSVG": true, "SVGFontSubsetting": true, "SVGDocumentEncoding": true, "SVGDTDVersion": true, "SVGCSSPropertyLocation": true, "SaveOptions": true, "Event": true, - "$": true + "$": true, + "it": true, + "describe": true } } From e39b509d7707206ad889faacdfe246990d26776a Mon Sep 17 00:00:00 2001 From: Alan Palazzolo Date: Thu, 3 Jan 2019 15:25:28 -0600 Subject: [PATCH 6/6] Adding editorconfig. --- .editorconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e717f5e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false