Skip to content

Commit

Permalink
style: fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Jul 30, 2021
1 parent cb23dc3 commit 58680b3
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 33 deletions.
8 changes: 6 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
!.eslintrc.js
.vscode/

# ember-try
/.node_modules.ember-try/

/tests/
/bower.json.ember-try
/package.json.ember-try
53 changes: 52 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,55 @@
'use strict';

// @TODO this can be removed once `trailingComma` is enabled upstream by default
const prettierTrailingComma = {
'prettier/prettier': [
'error',
require('@clark/prettier-config/trailing-comma'),
],
};

const ruleOverrides = {
...prettierTrailingComma,
};

module.exports = {
root: true,
extends: '@clark/node'
extends: ['@clark'],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
},
rules: {
...ruleOverrides,
},
overrides: [
{
files: ['app/**/*.js'],
extends: '@clark/ember',
rules: { ...ruleOverrides },
},
{
files: ['addon-test-support/**/*.js', 'tests/**/*.js'],
excludedFiles: ['tests/dummy/config/**/*.js'],
extends: '@clark/ember/test',
rules: { ...ruleOverrides },
},
{
files: ['addon-test-support/**/*.js'],
rules: {
'qunit/no-commented-tests': 'off',
},
},
{
files: [
'./*.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js',
'lib/**/*.js',
],
extends: '@clark/node',
rules: { ...ruleOverrides },
},
],
};
2 changes: 1 addition & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended'
extends: 'recommended',
};
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ module.exports = {

createCssModulesPlugin(parent) {
return new ClarkPlugin(parent);
}
},
};
16 changes: 8 additions & 8 deletions lib/clark-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ module.exports = class ClarkPlugin extends Plugin {
// Iterate over lists with @each
require('postcss-advanced-variables')({
disable: '@mixin, @include, @content',
unresolved: 'ignore'
unresolved: 'ignore',
}),

// https://github.com/jonathantneal/postcss-short
// Shorthand properties
require('postcss-short')
require('postcss-short'),

// https://github.com/simonsmith/postcss-property-lookup
// Lookup property values of the current rule set, e.g. padding-top: @margin-bottom
Expand Down Expand Up @@ -100,15 +100,15 @@ module.exports = class ClarkPlugin extends Plugin {
'matches-pseudo-class': true,
'has-pseudo-class': true,

'custom-selectors': true
'custom-selectors': true,
},

autoprefixer: {
// We don't manually apply prefixes unless they are really necessary,
// e.g.when dealing with quirks, therefore we disable removing them.
remove: false
}
})
remove: false,
},
}),
];

for (const [stage, plugins] of Object.entries({ before, after })) {
Expand All @@ -119,8 +119,8 @@ module.exports = class ClarkPlugin extends Plugin {
postcssOptions: {
// https://github.com/postcss/postcss-scss
// This allows you to use inline comments, like this one here.
parser: require('postcss-scss')
}
parser: require('postcss-scss'),
},
};
}
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"postcss-short": "^5.0.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.14.7",
"@clark/eslint-config-ember": "^2.2.0",
"@clark/eslint-config-node": "^2.2.0",
"@clark/prettier-config": "^2.2.0",
"@ember/optional-features": "^2.0.0",
Expand Down
8 changes: 4 additions & 4 deletions testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module.exports = {
'--disable-software-rasterizer',
'--mute-audio',
'--remote-debugging-port=0',
'--window-size=1440,900'
].filter(Boolean)
}
}
'--window-size=1440,900',
].filter(Boolean),
},
},
};
1 change: 1 addition & 0 deletions tests/dummy/app/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Application from '@ember/application';

import loadInitializers from 'ember-load-initializers';

import config from './config/environment';
Expand Down
6 changes: 3 additions & 3 deletions tests/dummy/app/router.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import EmberRouter from '@ember/routing/router';

import config from './config/environment';

export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
};
}

Router.map(function() {
});
Router.map(function () {});
10 changes: 5 additions & 5 deletions tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

module.exports = function(environment) {
let ENV = {
module.exports = function (environment) {
const ENV = {
modulePrefix: 'dummy',
environment,
rootURL: '/',
Expand All @@ -13,14 +13,14 @@ module.exports = function(environment) {
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false
}
Date: false,
},
},

APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
},
};

if (environment === 'development') {
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/config/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions'
'last 1 Safari versions',
];

// const isCI = !!process.env.CI;
// const isProduction = process.env.EMBER_ENV === 'production';

module.exports = {
browsers
browsers,
};
5 changes: 3 additions & 2 deletions tests/test-helper.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Application from '../app';
import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
import * as QUnit from 'qunit';
import { setup } from 'qunit-dom';

import Application from '../app';
import config from '../config/environment';

setup(QUnit.assert);

setApplication(Application.create(config.APP));
Expand Down
Loading

0 comments on commit 58680b3

Please sign in to comment.