Skip to content

Commit 5b7a057

Browse files
committed
fix: updates to fix eslint / prettier issues; update packages/core to reuse root .eslintrc.js file
1 parent d945acc commit 5b7a057

36 files changed

+205
-106
lines changed

.eslintignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**/node_modules/**
2+
node_modules
3+
**/vendor/**
4+
vendor
5+
**/test/**
6+
**/dist/**
7+
8+
// being refactored / removed
9+
packages/uikit-workshop/src/scripts/components/styleguide.js

.eslintrc.js

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
builtin: true,
6+
es6: true,
7+
browser: true,
8+
},
9+
parser: 'babel-eslint',
10+
parserOptions: {
11+
ecmaVersion: 2018,
12+
sourceType: 'module',
13+
allowImportExportEverywhere: true,
14+
ecmaFeatures: {
15+
jsx: true,
16+
experimentalDecorators: true,
17+
},
18+
},
19+
globals: {},
20+
plugins: ['prettier'],
21+
extends: ['eslint-config-prettier'].map(require.resolve),
22+
rules: {
23+
'prettier/prettier': 'error',
24+
'block-scoped-var': 0,
25+
camelcase: 0,
26+
'consistent-return': 2,
27+
curly: [2, 'all'],
28+
'dot-notation': [1, { allowKeywords: true }],
29+
eqeqeq: [2, 'allow-null'],
30+
'global-strict': [0, 'never'],
31+
'guard-for-in': 2,
32+
'key-spacing': 0,
33+
'new-cap': 0,
34+
'no-alert': 2,
35+
'no-bitwise': 2,
36+
'no-caller': 2,
37+
'no-cond-assign': [2, 'except-parens'],
38+
'no-debugger': 2,
39+
'no-dupe-args': 2,
40+
'no-dupe-keys': 2,
41+
'no-empty': 2,
42+
'no-eval': 2,
43+
'no-extend-native': 2,
44+
'no-extra-bind': 2,
45+
'no-extra-parens': 0,
46+
'no-func-assign': 2,
47+
'no-implied-eval': 2,
48+
'no-invalid-regexp': 2,
49+
'no-irregular-whitespace': 1,
50+
'no-iterator': 2,
51+
'no-loop-func': 2,
52+
'no-mixed-requires': 0,
53+
'no-multi-str': 2,
54+
'no-native-reassign': 2,
55+
'no-new': 2,
56+
'no-param-reassign': 1,
57+
'no-proto': 2,
58+
'no-redeclare': 0,
59+
'no-script-url': 2,
60+
'no-self-assign': 2,
61+
'no-self-compare': 2,
62+
'no-sequences': 2,
63+
'no-shadow': 2,
64+
'no-undef': 2,
65+
'no-underscore-dangle': 0,
66+
'no-unreachable': 1,
67+
'no-unused-vars': 1,
68+
'no-use-before-define': 1,
69+
'no-useless-call': 2,
70+
'no-useless-concat': 2,
71+
'no-var': 2,
72+
'no-with': 2,
73+
quotes: [0, 'single'],
74+
radix: 2,
75+
strict: 0,
76+
'valid-typeof': 2,
77+
'vars-on-top': 0,
78+
'prefer-const': [
79+
'error',
80+
{
81+
destructuring: 'any',
82+
ignoreReadBeforeAssign: false,
83+
},
84+
],
85+
},
86+
};

.eslintrc.json

-79
This file was deleted.

babel.config.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
targets: {
7+
node: 'current',
8+
},
9+
},
10+
],
11+
],
12+
plugins: [
13+
/**
14+
* 1. Helps with our Web Component Preact renderer
15+
*/
16+
'@babel/plugin-syntax-jsx' /* [1] */,
17+
[
18+
'@babel/plugin-transform-react-jsx' /* [1] */,
19+
{
20+
pragma: 'h',
21+
pragmaFrag: '"span"',
22+
throwIfNamespace: false,
23+
useBuiltIns: false,
24+
},
25+
],
26+
],
27+
};

lerna.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"eslin*",
1515
"husky",
1616
"prettier",
17-
"pretty-quick"
17+
"pretty-quick",
18+
"babel-eslint"
1819
]
1920
},
2021
"publish": {

package.json

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
{
22
"dependencies": {
3+
"@babel/plugin-proposal-decorators": "^7.4.4",
4+
"@babel/plugin-syntax-jsx": "^7.2.0",
5+
"babel-eslint": "^10.0.2",
6+
"eslint": "^6.1.0",
7+
"eslint-config-airbnb-base": "^14.0.0",
8+
"eslint-config-prettier": "^6.0.0",
9+
"eslint-plugin-import": "^2.18.2",
10+
"eslint-plugin-prettier": "^3.1.0",
311
"lerna": "3.11.0",
412
"prettier": "^1.14.3",
5-
"pretty-quick": "^1.8.0"
13+
"pretty-quick": "^1.11.1"
614
},
715
"private": true,
816
"scripts": {
17+
"postinstall": "npm run bootstrap",
918
"bootstrap": "lerna bootstrap",
10-
"setup": "npm install && npm run bootstrap && npm run build:uikit",
19+
"setup": "npm install && npm run build:uikit",
1120
"build:uikit": "cd packages/uikit-workshop && npm run build",
1221
"precommit": "pretty-quick --staged",
13-
"prettier": "prettier --config .prettierrc --write ./**/*.js --ignore-path .prettierignore",
22+
"lint:fix": "npm run lint -- --fix",
23+
"lint": "eslint --max-warnings 0 './packages/{core,cli,uikit-workshop}/**/*.js ' --ignore-path .eslintignore",
1424
"test": "lerna run test",
1525
"clean": "git clean -dfx"
1626
},

packages/cli/bin/cli-actions/disable.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
1212
*/
1313
const enable = options =>
1414
wrapAsync(function*() {
15-
const { parent: { config: configPath }, plugins } = options;
15+
const {
16+
parent: { config: configPath },
17+
plugins,
18+
} = options;
1619
const config = yield resolveConfig(configPath);
1720

1821
const spinner = ora(`⊙ patternlab → Disable …`).start();

packages/cli/bin/cli-actions/enable.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
1212
*/
1313
const enable = options =>
1414
wrapAsync(function*() {
15-
const { parent: { config: configPath }, plugins } = options;
15+
const {
16+
parent: { config: configPath },
17+
plugins,
18+
} = options;
1619
const config = yield resolveConfig(configPath);
1720

1821
const spinner = ora(`⊙ patternlab → Enable …`).start();

packages/cli/bin/install-edition.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-param-reassign */
12
'use strict';
23

34
const path = require('path');
@@ -35,7 +36,9 @@ const installEdition = (edition, config, projectDir) => {
3536
pkg.dependencies || {},
3637
yield getJSONKey(edition, 'dependencies')
3738
); // 3
38-
switch (edition) { // 4
39+
switch (
40+
edition // 4
41+
) {
3942
// 4.1
4043
case '@pattern-lab/edition-node-gulp': {
4144
yield copyAsync(

packages/cli/bin/patternlab.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
2+
/* eslint-disable no-unused-vars */
23
'use strict';
34
const cli = require('commander');
45
const path = require('path');

packages/cli/bin/utils.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ const wrapAsync = fn =>
9696
*/
9797
const asyncGlob = (pattern, opts) =>
9898
new Promise((resolve, reject) =>
99-
glob(
100-
pattern,
101-
opts,
102-
(err, matches) => (err !== null ? reject(err) : resolve(matches))
99+
glob(pattern, opts, (err, matches) =>
100+
err !== null ? reject(err) : resolve(matches)
103101
)
104102
);
105103

packages/core/.eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['../../.eslintrc.js'],
3+
};

packages/core/package.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@
2121
"update-notifier": "2.2.0"
2222
},
2323
"devDependencies": {
24-
"eslint": "4.18.2",
25-
"eslint-config-prettier": "2.9.0",
26-
"eslint-plugin-prettier": "2.6.0",
24+
"@babel/core": "^7.5.5",
25+
"@babel/plugin-proposal-decorators": "^7.4.4",
26+
"@babel/plugin-syntax-jsx": "^7.2.0",
27+
"babel-eslint": "^10.0.2",
28+
"eslint": "^6.1.0",
29+
"eslint-config-airbnb-base": "^14.0.0",
30+
"eslint-config-prettier": "^6.0.0",
31+
"eslint-plugin-import": "^2.18.2",
32+
"eslint-plugin-prettier": "^3.1.0",
33+
"prettier": "^1.14.3",
2734
"husky": "0.14.3",
2835
"jsdoc-to-markdown": "3.0.0",
29-
"prettier": "1.11.1",
30-
"pretty-quick": "1.2.2",
36+
"pretty-quick": "^1.11.1",
3137
"rewire": "2.5.2",
3238
"standard-version": "4.3.0",
3339
"tap": "11.1.1"
@@ -59,7 +65,7 @@
5965
"license": "MIT",
6066
"scripts": {
6167
"docs": "node ./scripts/docs.js",
62-
"lint": "eslint src/**/*.js",
68+
"lint": "eslint -c ../../.eslintrc.js 'src/**/*.js'",
6369
"pretest": "npm run lint",
6470
"release": "standard-version",
6571
"test": "tap test/*_tests.js --reporter spec --coverage"

packages/uikit-workshop/src/scripts/components/base-component.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-vars */
12
import { withComponent, shadow } from 'skatejs';
23
import withPreact from '@skatejs/renderer-preact';
34
import { store } from '../store.js';

packages/uikit-workshop/src/scripts/components/modal-styleguide.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-param-reassign, no-unused-vars */
12
/**
23
* "Modal" (aka Panel UI) for the Styleguide Layer - for both annotations and code/info
34
*/

packages/uikit-workshop/src/scripts/components/modal-viewer.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-vars */
12
/**
23
* "Modal" (aka Panel UI) for the Viewer Layer - for both annotations and code/info
34
*/

packages/uikit-workshop/src/scripts/components/panels-util.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-vars */
12
/**
23
* Panels Util - for both styleguide and viewer
34
*/

packages/uikit-workshop/src/scripts/components/panels-viewer.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Panel Builder - supports building the panels to be included in the modal or styleguide
33
*/
4+
/* eslint-disable no-param-reassign, no-unused-vars */
45

56
import $ from 'jquery';
67
import Hogan from 'hogan.js';
@@ -307,6 +308,7 @@ export const panelsViewer = {
307308
* 5) Add mouseup event to the body so that when drag is released, the modal
308309
* stops resizing and modal cover doesn't display anymore.
309310
*/
311+
// eslint-disable-next-line no-unused-vars
310312
$('.pl-js-modal-resizer').mousedown(function(event) {
311313
/* 1 */
312314

packages/uikit-workshop/src/scripts/components/pl-controls/pl-controls.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-vars, no-param-reassign */
12
import { define, props } from 'skatejs';
23
import { h } from 'preact';
34
const classNames = require('classnames');

0 commit comments

Comments
 (0)