eslint-plugin-gjs
Advanced tools
Comparing version 0.0.1 to 1.0.0
138
lib/index.js
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
"use strict"; | ||
'use strict'; | ||
@@ -12,3 +12,3 @@ //------------------------------------------------------------------------------ | ||
var requireIndex = require("requireindex"); | ||
var requireIndex = require('requireindex'); | ||
@@ -21,33 +21,63 @@ //------------------------------------------------------------------------------ | ||
// import all rules in lib/rules | ||
const GJS_INDENT = 4; | ||
const GJS_RULES = { | ||
'comma': 'error', | ||
'no-unreachable': 'error', | ||
'no-undef': 'error', | ||
'no-dupe-keys': 'error', | ||
'keyword-spacing': 'error', | ||
'space-before-function-paren': ['error', { | ||
'anonymous': 'never', | ||
'named': 'never', | ||
'asyncArrow': 'always' | ||
}], | ||
'linebreak-style': ['error', 'unix'], | ||
'object-shorthand': ['error', 'never'], | ||
'space-before-blocks': ['error', 'always'], | ||
'brace-style': ['error', '1tbs'], | ||
'indent': ['error', GJS_INDENT], | ||
'no-var': 'error', | ||
'no-trailing-spaces': 'error', | ||
'no-tabs': 'error', | ||
'semi': 'error', | ||
'gjs/no-computed-properties': 'error', | ||
'gjs/no-generators': 'error', | ||
'gjs/no-invalid-regexp': ['error', { 'allowConstructorFlags': ['y'] }], | ||
'gjs/no-js-class': 'error', | ||
'gjs/no-modules': 'error', | ||
'gjs/no-numeric-literals': 'error', | ||
'gjs/no-spread': 'error', | ||
'gjs/no-super': 'error', | ||
'gjs/no-template-strings': 'error', | ||
'gjs/translation-strings': 'error' | ||
}; | ||
const GJS_GLOBALS_BASE = { | ||
'log': false, | ||
'logError': false, | ||
'print': false, | ||
'printerr': false, | ||
'imports': false, | ||
'ARGV': false, | ||
'global': false | ||
}; | ||
module.exports = { | ||
rules: requireIndex(__dirname + "/rules"), | ||
rules: requireIndex(__dirname + '/rules'), | ||
// import processors | ||
processors: {}, | ||
environments: { | ||
"application": { | ||
globals: { | ||
"log": false, | ||
"logError": false, | ||
"print": false, | ||
"printerr": false, | ||
"imports": false, | ||
"ARGV": false, | ||
"global": false, | ||
"pkg": false, | ||
"window": false | ||
} | ||
'application': { | ||
globals: function () { | ||
return Object.assign({ | ||
window: false, | ||
pkg: false | ||
}, GJS_GLOBALS_BASE); | ||
} () | ||
}, | ||
"shell-extension": { | ||
globals: { | ||
"log": false, | ||
"logError": false, | ||
"print": false, | ||
"printerr": false, | ||
"imports": false, | ||
"ARGV": false, | ||
"global": false | ||
} | ||
'shell-extension': { | ||
globals: GJS_GLOBALS_BASE | ||
} | ||
@@ -57,53 +87,19 @@ }, | ||
configs: { | ||
"extension": { | ||
plugin: ["gjs"], | ||
'extension': { | ||
plugin: ['gjs'], | ||
env: { | ||
"es6": true, | ||
"gjs/shell-extension": true | ||
'es6': true, | ||
'gjs/shell-extension': true | ||
}, | ||
rules: { | ||
"no-undef": ["error"], | ||
"keyword-spacing": ["error"], | ||
"space-before-function-paren": ["error", { | ||
"anonymous": "never", | ||
"named": "never", | ||
"asyncArrow": "always" | ||
}], | ||
"space-before-blocks": ["error", "always"], | ||
"brace-style": ["error", "1tbs"], | ||
"indent": ["error", 4], | ||
"no-var": "error", | ||
"no-trailing-spaces": "error", | ||
"no-tabs": "error", | ||
"semi": "error", | ||
"gjs/translatable-strings": "error", | ||
"gjs/unsupported-syntax": "error" | ||
} | ||
rules: GJS_RULES | ||
}, | ||
"application": { | ||
plugin: ["gjs"], | ||
'application': { | ||
plugin: ['gjs'], | ||
env: { | ||
"es6": true, | ||
"gjs/application": true | ||
'es6': true, | ||
'gjs/application': true | ||
}, | ||
rules: { | ||
"no-undef": ["error"], | ||
"keyword-spacing": ["error"], | ||
"space-before-function-paren": ["error", { | ||
"anonymous": "never", | ||
"named": "never", | ||
"asyncArrow": "always" | ||
}], | ||
"space-before-blocks": ["error", "always"], | ||
"brace-style": ["error", "1tbs"], | ||
"indent": ["error", 4], | ||
"no-var": "error", | ||
"no-trailing-spaces": "error", | ||
"no-tabs": "error", | ||
"semi": "error", | ||
"gjs/translatable-strings": "error", | ||
"gjs/unsupported-syntax": "error" | ||
} | ||
rules: GJS_RULES | ||
} | ||
} | ||
}; |
{ | ||
"name": "eslint-plugin-gjs", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Adds compatibility for the GJS environment.", | ||
@@ -8,3 +8,6 @@ "keywords": [ | ||
"eslintplugin", | ||
"eslint-plugin" | ||
"eslint-plugin", | ||
"gnome", | ||
"gjs", | ||
"gnome-shell" | ||
], | ||
@@ -17,3 +20,4 @@ "author": "rockon999", | ||
"dependencies": { | ||
"requireindex": "~1.1.0" | ||
"requireindex": "~1.1.0", | ||
"espree": "^3.1.6" | ||
}, | ||
@@ -27,3 +31,3 @@ "devDependencies": { | ||
}, | ||
"license": "ISC" | ||
"license": "MIT" | ||
} |
# eslint-plugin-gjs | ||
Adds compatibility for the GJS environment. | ||
Adds compatibility for the GJS (Gnome JavaScript) environment. | ||
@@ -23,19 +23,20 @@ ## Installation | ||
Add `gjs` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: | ||
Add `gjs` to the plugins section of your `.eslintrc` configuration file. | ||
Depending on your use case, add either `plugin:gjs/extension` or `plugin:gjs/application` to your extends section. | ||
```json | ||
{ | ||
"plugins": [ | ||
"gjs" | ||
] | ||
"plugins": ["gjs"], | ||
"extends": [ "plugin:gjs/extension" ] | ||
} | ||
``` | ||
The plugin automatically imports all relevant rules. If you would like to avoid this, add `gjs/application` or `gjs/shell-extension` to your env section. Then remove `"extends": [ "plugin:gjs/extension" ]`. | ||
Then configure the rules you want to use under the rules section. | ||
```json | ||
{ | ||
"rules": { | ||
"gjs/rule-name": 2 | ||
"plugins": ["gjs"], | ||
"env": { | ||
"es6": true, | ||
"gjs/application": true | ||
} | ||
@@ -47,7 +48,23 @@ } | ||
* Fill in provided rules here | ||
* gjs/no-computed-properties | ||
* gjs/no-generators | ||
* gjs/no-invalid-regexp | ||
* gjs/no-js-class | ||
* gjs/no-modules | ||
* gjs/no-numeric-literals | ||
* gjs/no-spread | ||
* gjs/no-super | ||
* gjs/no-template-strings | ||
* gjs/translation-strings | ||
* DEPRECATED: gjs/no-unsupported-syntax | ||
# Not Implemented | ||
* Lang.Class member formatting | ||
* Object literal formatting (unlikely to be implemented) | ||
* Lang.bind enforcement for closures | ||
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
42738
26
0
1064
1
69
2
1
+ Addedespree@^3.1.6
+ Addedacorn@3.3.05.7.4(transitive)
+ Addedacorn-jsx@3.0.1(transitive)
+ Addedespree@3.5.4(transitive)