Skip to content

Commit

Permalink
fix: updates to fix eslint / prettier issues; update packages/core to…
Browse files Browse the repository at this point in the history
… reuse root .eslintrc.js file
  • Loading branch information
sghoweri committed Aug 12, 2019
1 parent d945acc commit 5b7a057
Show file tree
Hide file tree
Showing 36 changed files with 205 additions and 106 deletions.
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/node_modules/**
node_modules
**/vendor/**
vendor
**/test/**
**/dist/**

// being refactored / removed
packages/uikit-workshop/src/scripts/components/styleguide.js
86 changes: 86 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
module.exports = {
root: true,
env: {
node: true,
builtin: true,
es6: true,
browser: true,
},
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
allowImportExportEverywhere: true,
ecmaFeatures: {
jsx: true,
experimentalDecorators: true,
},
},
globals: {},
plugins: ['prettier'],
extends: ['eslint-config-prettier'].map(require.resolve),
rules: {
'prettier/prettier': 'error',
'block-scoped-var': 0,
camelcase: 0,
'consistent-return': 2,
curly: [2, 'all'],
'dot-notation': [1, { allowKeywords: true }],
eqeqeq: [2, 'allow-null'],
'global-strict': [0, 'never'],
'guard-for-in': 2,
'key-spacing': 0,
'new-cap': 0,
'no-alert': 2,
'no-bitwise': 2,
'no-caller': 2,
'no-cond-assign': [2, 'except-parens'],
'no-debugger': 2,
'no-dupe-args': 2,
'no-dupe-keys': 2,
'no-empty': 2,
'no-eval': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-parens': 0,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-invalid-regexp': 2,
'no-irregular-whitespace': 1,
'no-iterator': 2,
'no-loop-func': 2,
'no-mixed-requires': 0,
'no-multi-str': 2,
'no-native-reassign': 2,
'no-new': 2,
'no-param-reassign': 1,
'no-proto': 2,
'no-redeclare': 0,
'no-script-url': 2,
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow': 2,
'no-undef': 2,
'no-underscore-dangle': 0,
'no-unreachable': 1,
'no-unused-vars': 1,
'no-use-before-define': 1,
'no-useless-call': 2,
'no-useless-concat': 2,
'no-var': 2,
'no-with': 2,
quotes: [0, 'single'],
radix: 2,
strict: 0,
'valid-typeof': 2,
'vars-on-top': 0,
'prefer-const': [
'error',
{
destructuring: 'any',
ignoreReadBeforeAssign: false,
},
],
},
};
79 changes: 0 additions & 79 deletions .eslintrc.json

This file was deleted.

27 changes: 27 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
plugins: [
/**
* 1. Helps with our Web Component Preact renderer
*/
'@babel/plugin-syntax-jsx' /* [1] */,
[
'@babel/plugin-transform-react-jsx' /* [1] */,
{
pragma: 'h',
pragmaFrag: '"span"',
throwIfNamespace: false,
useBuiltIns: false,
},
],
],
};
3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"eslin*",
"husky",
"prettier",
"pretty-quick"
"pretty-quick",
"babel-eslint"
]
},
"publish": {
Expand Down
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
{
"dependencies": {
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-syntax-jsx": "^7.2.0",
"babel-eslint": "^10.0.2",
"eslint": "^6.1.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^3.1.0",
"lerna": "3.11.0",
"prettier": "^1.14.3",
"pretty-quick": "^1.8.0"
"pretty-quick": "^1.11.1"
},
"private": true,
"scripts": {
"postinstall": "npm run bootstrap",
"bootstrap": "lerna bootstrap",
"setup": "npm install && npm run bootstrap && npm run build:uikit",
"setup": "npm install && npm run build:uikit",
"build:uikit": "cd packages/uikit-workshop && npm run build",
"precommit": "pretty-quick --staged",
"prettier": "prettier --config .prettierrc --write ./**/*.js --ignore-path .prettierignore",
"lint:fix": "npm run lint -- --fix",
"lint": "eslint --max-warnings 0 './packages/{core,cli,uikit-workshop}/**/*.js ' --ignore-path .eslintignore",
"test": "lerna run test",
"clean": "git clean -dfx"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/bin/cli-actions/disable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
*/
const enable = options =>
wrapAsync(function*() {
const { parent: { config: configPath }, plugins } = options;
const {
parent: { config: configPath },
plugins,
} = options;
const config = yield resolveConfig(configPath);

const spinner = ora(`⊙ patternlab → Disable …`).start();
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/bin/cli-actions/enable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
*/
const enable = options =>
wrapAsync(function*() {
const { parent: { config: configPath }, plugins } = options;
const {
parent: { config: configPath },
plugins,
} = options;
const config = yield resolveConfig(configPath);

const spinner = ora(`⊙ patternlab → Enable …`).start();
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/bin/install-edition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
'use strict';

const path = require('path');
Expand Down Expand Up @@ -35,7 +36,9 @@ const installEdition = (edition, config, projectDir) => {
pkg.dependencies || {},
yield getJSONKey(edition, 'dependencies')
); // 3
switch (edition) { // 4
switch (
edition // 4
) {
// 4.1
case '@pattern-lab/edition-node-gulp': {
yield copyAsync(
Expand Down
1 change: 1 addition & 0 deletions packages/cli/bin/patternlab.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node
/* eslint-disable no-unused-vars */
'use strict';
const cli = require('commander');
const path = require('path');
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/bin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,8 @@ const wrapAsync = fn =>
*/
const asyncGlob = (pattern, opts) =>
new Promise((resolve, reject) =>
glob(
pattern,
opts,
(err, matches) => (err !== null ? reject(err) : resolve(matches))
glob(pattern, opts, (err, matches) =>
err !== null ? reject(err) : resolve(matches)
)
);

Expand Down
3 changes: 3 additions & 0 deletions packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['../../.eslintrc.js'],
};
18 changes: 12 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@
"update-notifier": "2.2.0"
},
"devDependencies": {
"eslint": "4.18.2",
"eslint-config-prettier": "2.9.0",
"eslint-plugin-prettier": "2.6.0",
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-syntax-jsx": "^7.2.0",
"babel-eslint": "^10.0.2",
"eslint": "^6.1.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^3.1.0",
"prettier": "^1.14.3",
"husky": "0.14.3",
"jsdoc-to-markdown": "3.0.0",
"prettier": "1.11.1",
"pretty-quick": "1.2.2",
"pretty-quick": "^1.11.1",
"rewire": "2.5.2",
"standard-version": "4.3.0",
"tap": "11.1.1"
Expand Down Expand Up @@ -59,7 +65,7 @@
"license": "MIT",
"scripts": {
"docs": "node ./scripts/docs.js",
"lint": "eslint src/**/*.js",
"lint": "eslint -c ../../.eslintrc.js 'src/**/*.js'",
"pretest": "npm run lint",
"release": "standard-version",
"test": "tap test/*_tests.js --reporter spec --coverage"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
import { withComponent, shadow } from 'skatejs';
import withPreact from '@skatejs/renderer-preact';
import { store } from '../store.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign, no-unused-vars */
/**
* "Modal" (aka Panel UI) for the Styleguide Layer - for both annotations and code/info
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/**
* "Modal" (aka Panel UI) for the Viewer Layer - for both annotations and code/info
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/**
* Panels Util - for both styleguide and viewer
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Panel Builder - supports building the panels to be included in the modal or styleguide
*/
/* eslint-disable no-param-reassign, no-unused-vars */

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

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

0 comments on commit 5b7a057

Please sign in to comment.