1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

switch from jshint/jscs to eslint

no issue
- drop `jshint`, `jscs`, and `ember-suave` dependencies
- remove `grunt` related linting dependencies and tasks
- remove linting build from Travis so that linting can be performed as part of the normal test suite (refs TryGhost/Ghost#7427)
- add `ember-cli-eslint` and `eslint-plugin-ember-suave` dependencies
- configure `eslint` to match our previous coding style
- update config to run eslint tests as part of the normal test run
- add `npm run lint` command to only run linter tests
This commit is contained in:
Kevin Ansfield 2016-10-14 11:23:51 +01:00
parent cd1fe4aeea
commit 2265ee25c8
14 changed files with 54 additions and 185 deletions

29
.eslintrc.js Normal file
View file

@ -0,0 +1,29 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
extends: [
'eslint:recommended',
'plugin:ember-suave/recommended'
],
env: {
browser: true
},
rules: {
indent: ['error', 4],
'space-before-function-paren': ['error', {anonymous: 'ignore', named: 'never'}],
'object-curly-spacing': ['error', 'never'],
'array-bracket-spacing': ['error', 'never'],
'key-spacing': ['error', {mode: 'minimum'}],
'keyword-spacing': ['error', {overrides: {
'catch': {'after': true}
}}],
'ember-suave/require-access-in-comments': 'off'
},
globals: {
moment: false,
validator: false
}
};

14
.jscsrc
View file

@ -1,14 +0,0 @@
{
"preset": "ember-suave",
"validateIndentation": 4,
"disallowSpacesInFunction": null,
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideObjectBrackets": "all",
"requireCommentsToIncludeAccess": null,
"requireSpacesInsideObjectBrackets": null
}

View file

@ -1,36 +0,0 @@
{
"predef": [
"server",
"document",
"window",
"-Promise",
"-Notification",
"validator",
"moment"
],
"browser": true,
"boss": true,
"curly": true,
"debug": false,
"devel": true,
"eqeqeq": true,
"evil": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": false,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": false,
"eqnull": true,
"esversion": 6,
"unused": true
}

View file

@ -9,11 +9,6 @@ env:
global: global:
- GITHUB_OAUTH_KEY=003a44d58f12089d0c0261338298af3813330949 - GITHUB_OAUTH_KEY=003a44d58f12089d0c0261338298af3813330949
matrix:
include:
- node_js: "4"
env: TEST_SUITE=lint
branches: branches:
except: except:
- /^greenkeeper-.+$/ - /^greenkeeper-.+$/
@ -43,4 +38,4 @@ before_script:
- export DISPLAY=:99; sh -e /etc/init.d/xvfb start; sleep 3; - export DISPLAY=:99; sh -e /etc/init.d/xvfb start; sleep 3;
script: script:
- if [ "$TEST_SUITE" == "lint" ]; then grunt lint; else npm test; fi - if [ "$TEST_SUITE" == "lint" ]; then npm run lint; else npm test; fi

View file

@ -35,53 +35,6 @@ module.exports = function(grunt) {
} }
}, },
jshint: {
options: {
jshintrc: true,
ignores: [
'node_modules/**',
'bower_components/**',
'tmp/**',
'dist/**',
'vendor/**'
]
},
all: ['**/*.js']
},
jscs: {
app: {
options: {
config: '.jscsrc',
excludeFiles: [
'node_modules/**',
'bower_components/**',
'tests/**',
'tmp/**',
'dist/**',
'vendor/**'
]
},
files: {
src: ['**/*.js']
}
},
tests: {
options: {
config: 'tests/.jscsrc'
},
files: {
src: [
'tests/**/*.js'
]
}
}
},
// ### grunt-bg-shell // ### grunt-bg-shell
// Used to run ember-cli watch in the background // Used to run ember-cli watch in the background
bgShell: { bgShell: {
@ -146,10 +99,6 @@ module.exports = function(grunt) {
['shell:npm-install', 'shell:bower-install'] ['shell:npm-install', 'shell:bower-install']
); );
grunt.registerTask('lint', 'Run the code style checks and linter',
['jshint', 'jscs', 'shell:csscomblint']
);
// ### Build About Page *(Utility Task)* // ### Build About Page *(Utility Task)*
// Builds the github contributors partial template used on the about page, // Builds the github contributors partial template used on the about page,
// and downloads the avatar for each of the users. // and downloads the avatar for each of the users.

View file

@ -1,4 +1,3 @@
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
import Oauth2Authenticator from './oauth2'; import Oauth2Authenticator from './oauth2';
import RSVP from 'rsvp'; import RSVP from 'rsvp';
import run from 'ember-runloop'; import run from 'ember-runloop';

View file

@ -0,0 +1,6 @@
module.exports = {
rules: {
'brace-style': 'off',
'camelcase': 'off'
}
};

View file

@ -1,6 +1,7 @@
{ {
"name": "ghost-admin", "name": "ghost-admin",
"dependencies": { "dependencies": {
"Faker": "3.1.0",
"devicejs": "0.2.7", "devicejs": "0.2.7",
"ember": "2.9.0", "ember": "2.9.0",
"ember-cli-shims": "0.1.3", "ember-cli-shims": "0.1.3",
@ -10,8 +11,8 @@
"google-caja": "6005.0.0", "google-caja": "6005.0.0",
"jquery-file-upload": "9.12.3", "jquery-file-upload": "9.12.3",
"jquery-ui": "1.11.4", "jquery-ui": "1.11.4",
"jqueryui-touch-punch": "furf/jquery-ui-touch-punch#4bc009145202d9c7483ba85f3a236a8f3470354d",
"jquery.simulate.drag-sortable": "0.1.0", "jquery.simulate.drag-sortable": "0.1.0",
"jqueryui-touch-punch": "furf/jquery-ui-touch-punch#4bc009145202d9c7483ba85f3a236a8f3470354d",
"keymaster": "1.6.3", "keymaster": "1.6.3",
"lodash": "3.7.0", "lodash": "3.7.0",
"normalize.css": "3.0.3", "normalize.css": "3.0.3",

View file

@ -1,4 +1,4 @@
/* jscs:disable */ /* eslint-disable */
/* global require, module */ /* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app'), var EmberApp = require('ember-cli/lib/broccoli/ember-app'),
@ -86,7 +86,6 @@ module.exports = function (defaults) {
compress: mythCompress, compress: mythCompress,
outputFile: isProduction ? 'ghost.min.css' : 'ghost.css' outputFile: isProduction ? 'ghost.min.css' : 'ghost.css'
}, },
hinting: false,
fingerprint: disabled, fingerprint: disabled,
nodeAssets: { nodeAssets: {
'blueimp-md5': { 'blueimp-md5': {

View file

@ -1,4 +0,0 @@
{
"node": true,
"browser": false
}

View file

@ -18,7 +18,8 @@
"scripts": { "scripts": {
"start": "ember server", "start": "ember server",
"build": "ember build", "build": "ember build",
"test": "ember test" "test": "ember test",
"lint": "ember test --launch phantomjs -f 'ESLint'"
}, },
"engines": { "engines": {
"node": "~0.12.0 || ^4.2.0" "node": "~0.12.0 || ^4.2.0"
@ -42,10 +43,10 @@
"ember-cli-content-security-policy": "0.5.0", "ember-cli-content-security-policy": "0.5.0",
"ember-cli-dependency-checker": "1.3.0", "ember-cli-dependency-checker": "1.3.0",
"ember-cli-deprecation-workflow": "0.2.3", "ember-cli-deprecation-workflow": "0.2.3",
"ember-cli-eslint": "3.0.0",
"ember-cli-fastclick": "1.3.0", "ember-cli-fastclick": "1.3.0",
"ember-cli-htmlbars": "1.1.0", "ember-cli-htmlbars": "1.1.0",
"ember-cli-htmlbars-inline-precompile": "0.3.6", "ember-cli-htmlbars-inline-precompile": "0.3.6",
"ember-cli-jshint": "2.0.1",
"ember-cli-mirage": "0.1.14", "ember-cli-mirage": "0.1.14",
"ember-cli-mocha": "0.11.0", "ember-cli-mocha": "0.11.0",
"ember-cli-node-assets": "0.1.4", "ember-cli-node-assets": "0.1.4",
@ -69,19 +70,17 @@
"ember-simple-auth": "1.1.0", "ember-simple-auth": "1.1.0",
"ember-sinon": "0.5.1", "ember-sinon": "0.5.1",
"ember-sortable": "1.9.0", "ember-sortable": "1.9.0",
"ember-suave": "4.0.1",
"ember-watson": "0.8.3", "ember-watson": "0.8.3",
"ember-wormhole": "0.5.1", "ember-wormhole": "0.5.1",
"emberx-file-input": "1.1.0", "emberx-file-input": "1.1.0",
"eslint-plugin-ember-suave": "1.0.0",
"fs-extra": "1.0.0", "fs-extra": "1.0.0",
"ghost-editor": "0.1.4", "ghost-editor": "0.1.4",
"glob": "7.1.1", "glob": "7.1.1",
"grunt": "1.0.1", "grunt": "1.0.1",
"grunt-bg-shell": "2.3.3", "grunt-bg-shell": "2.3.3",
"grunt-contrib-clean": "1.0.0", "grunt-contrib-clean": "1.0.0",
"grunt-contrib-jshint": "1.0.0",
"grunt-contrib-watch": "1.0.0", "grunt-contrib-watch": "1.0.0",
"grunt-jscs": "3.0.1",
"grunt-shell": "1.3.1", "grunt-shell": "1.3.1",
"jquery-deparam": "0.5.2", "jquery-deparam": "0.5.2",
"liquid-fire": "0.26.4", "liquid-fire": "0.26.4",
@ -106,9 +105,7 @@
"grunt", "grunt",
"grunt-bg-shell", "grunt-bg-shell",
"grunt-contrib-clean", "grunt-contrib-clean",
"grunt-contrib-jshint",
"grunt-contrib-watch", "grunt-contrib-watch",
"grunt-jscs",
"grunt-shell" "grunt-shell"
] ]
} }

11
tests/.eslintrc.js Normal file
View file

@ -0,0 +1,11 @@
module.exports = {
env: {
'embertest': true,
'mocha': true
},
globals: {
server: false,
expect: false,
fileUpload: false
}
};

View file

@ -1,4 +0,0 @@
{
"preset": "../.jscsrc",
"requireBlocksOnNewline": null
}

View file

@ -1,59 +0,0 @@
{
"predef": [
"server",
"authenticateSession",
"invalidateSession",
"currentSession",
"document",
"window",
"location",
"setTimeout",
"-Promise",
"define",
"console",
"visit",
"exists",
"fillIn",
"click",
"keyEvent",
"triggerEvent",
"find",
"findWithAssert",
"wait",
"DS",
"andThen",
"currentURL",
"currentPath",
"currentRouteName",
"expect",
"fileUpload",
"moment"
],
"mocha": true,
"node": false,
"browser": false,
"boss": true,
"curly": false,
"debug": false,
"devel": false,
"eqeqeq": true,
"evil": true,
"expr": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": false,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": false,
"eqnull": true,
"esversion": 6
}