Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(package): Add ESLint #1796

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.min.js
/components.js
/scripts/utopia.js
/scripts/vendor/**
114 changes: 114 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"env": {
"browser": true,
"commonjs": true,
},
"extends": "eslint:recommended",
"globals": {
"Prism": "readonly",
},
"parserOptions": {
"ecmaVersion": 5,
},
"root": true,
"rules": {
"comma-dangle": [
"warn",
"only-multiline",
],
"linebreak-style": [
"error",
"unix",
],
"no-console": "off",
"no-empty": [
"warn",
{
"allowEmptyCatch": true,
}
],
"no-inner-declarations": "off",
"no-mixed-spaces-and-tabs": "error",
"no-redeclare": "error",
"no-sparse-arrays": "off",
"no-unused-vars": [
"warn",
{
"args": "none",
}
],
"no-useless-escape": "off",
"semi": [
"error",
"always",
],
},
"overrides": [
{
"files": [
"components/*.js",
"gulpfile.js",
],
"rules": {
"quotes": [
"warn",
"single",
{
"avoidEscape": true,
}
],
},
},
{
"files": [
"components/prism-core.js",
"prism.js",
],
"globals": {
"WorkerGlobalScope": "readonly",
},
},
{
"files": [
"tests/**/*.js"
],
"env": {
"es6": true,
"node": true,
"mocha": true,
},
"parserOptions": {
"ecmaVersion": 2015,
},
},
{
"files": [
"gulpfile.js",
],
"env": {
"es6": true,
"node": true,
},
"parserOptions": {
"ecmaVersion": 2015,
},
},
{
"files": [
"scripts/**/*.js",
],
ExE-Boss marked this conversation as resolved.
Show resolved Hide resolved
"globals": {
"$": "readonly",
"$$": "readonly",
"$u": "readonly",
"Utopia": "readonly",
"Promise": "readonly",
"components": "readonly",
"setTheme": "readonly",
"saveAs": "readonly",
"PrefixFree": "readonly",
"StyleFix": "readonly",
},
}
]
}
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ before_script:
- npm install -g gulp
- gulp
- gulp premerge
script: npm test
script:
- gulp lint
- npm test
deploy:
provider: npm
email: lea@verou.me
Expand Down
16 changes: 8 additions & 8 deletions components/prism-abap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/prism-aspnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:(
// match directives of attribute value foo="<% Bar %>"
Prism.languages.insertBefore('inside', 'punctuation', {
'directive tag': Prism.languages.aspnet['directive tag']
}, Prism.languages.aspnet.tag.inside["attr-value"]);
}, Prism.languages.aspnet.tag.inside['attr-value']);

Prism.languages.insertBefore('aspnet', 'comment', {
'asp comment': /<%--[\s\S]*?--%>/
Expand Down
24 changes: 12 additions & 12 deletions components/prism-autoit.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
Prism.languages.autoit = {
"comment": [
'comment': [
/;.*/,
{
// The multi-line comments delimiters can actually be commented out with ";"
pattern: /(^\s*)#(?:comments-start|cs)[\s\S]*?^\s*#(?:comments-end|ce)/m,
lookbehind: true
}
],
"url": {
'url': {
pattern: /(^\s*#include\s+)(?:<[^\r\n>]+>|"[^\r\n"]+")/m,
lookbehind: true
},
"string": {
'string': {
pattern: /(["'])(?:\1\1|(?!\1)[^\r\n])*\1/,
greedy: true,
inside: {
"variable": /([%$@])\w+\1/
'variable': /([%$@])\w+\1/
}
},
"directive": {
'directive': {
pattern: /(^\s*)#\w+/m,
lookbehind: true,
alias: 'keyword'
},
"function": /\b\w+(?=\()/,
'function': /\b\w+(?=\()/,
// Variables and macros
"variable": /[$@]\w+/,
"keyword": /\b(?:Case|Const|Continue(?:Case|Loop)|Default|Dim|Do|Else(?:If)?|End(?:Func|If|Select|Switch|With)|Enum|Exit(?:Loop)?|For|Func|Global|If|In|Local|Next|Null|ReDim|Select|Static|Step|Switch|Then|To|Until|Volatile|WEnd|While|With)\b/i,
"number": /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,
"boolean": /\b(?:True|False)\b/i,
"operator": /<[=>]?|[-+*\/=&>]=?|[?^]|\b(?:And|Or|Not)\b/i,
"punctuation": /[\[\]().,:]/
'variable': /[$@]\w+/,
'keyword': /\b(?:Case|Const|Continue(?:Case|Loop)|Default|Dim|Do|Else(?:If)?|End(?:Func|If|Select|Switch|With)|Enum|Exit(?:Loop)?|For|Func|Global|If|In|Local|Next|Null|ReDim|Select|Static|Step|Switch|Then|To|Until|Volatile|WEnd|While|With)\b/i,
'number': /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,
'boolean': /\b(?:True|False)\b/i,
'operator': /<[=>]?|[-+*\/=&>]=?|[?^]|\b(?:And|Or|Not)\b/i,
'punctuation': /[\[\]().,:]/
};
2 changes: 1 addition & 1 deletion components/prism-cil.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Prism.languages.cil = {
'number': /\b-?(?:0x[0-9a-fA-F]+|[0-9]+)(?:\.[0-9a-fA-F]+)?\b/i,

'punctuation': /[{}[\];(),:=]|IL_[0-9A-Za-z]+/
}
};
8 changes: 4 additions & 4 deletions components/prism-coffeescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

// Ignore comments starting with { to privilege string interpolation highlighting
var comment = /#(?!\{).+/,
interpolation = {
pattern: /#\{[^}]+\}/,
alias: 'variable'
};
interpolation = {
pattern: /#\{[^}]+\}/,
alias: 'variable'
};

Prism.languages.coffeescript = Prism.languages.extend('javascript', {
'comment': comment,
Expand Down
Loading