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 diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..2074ceb --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,40 @@ +{ + "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, + "ExportOptionsSVG": true, + "SVGFontSubsetting": true, + "SVGDocumentEncoding": true, + "SVGDTDVersion": true, + "SVGCSSPropertyLocation": true, + "SaveOptions": true, + "Event": true, + "$": true, + "it": true, + "describe": true + } +} 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. diff --git a/package.json b/package.json index 357c28a..7f2bc8e 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"