Skip to content

Commit

Permalink
🔖 0.2.0 (#4)
Browse files Browse the repository at this point in the history
### Description
- ✨Complete rewrite
  - `/`
  - `/base` entry point
  • Loading branch information
a-tokyo authored Jul 4, 2018
1 parent 3a510ba commit 8ebacad
Show file tree
Hide file tree
Showing 18 changed files with 2,675 additions and 204 deletions.
34 changes: 34 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# Specify the version you desire here
- image: circleci/node:7.10

working_directory: ~/repo

steps:
- checkout

# Download and cache de¯pendencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

# Install dependencies
- run: yarn

# Save cache
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# run circleci tests script
- run: yarn test
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"extends": "./index.js"
"extends": "./index.js",
"rules": {
"comma-dangle": 0,
"prefer-destructuring": 0
}
}
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
.DS_Store
coverage/
# node
node_modules/
npm-debug.log

# testing
coverage/

# local files
.DS_Store

# editors
.vscode
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
language: node_js
node_js:
- "10"
- "9"
- "8"
- "7"
- "6"
- "5"
- "4"
before_install:
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g [email protected] ;; 2.*) npm install -g npm@2 ;; esac ; fi'
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi'
- 'nvm install-latest-npm'
install:
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
script:
- 'npm run travis'
sudo: false
Expand Down
82 changes: 57 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,76 @@
# Plural's Javascript Styleguide {
How Plural paints its code;
🎨 How plural paints its code;

[![npm version](https://badge.fury.io/js/eslint-config-plural.svg)](https://badge.fury.io/js/eslint-config-plural) [![Build Status](https://travis-ci.org/pluralcom/eslint-config-plural.svg?branch=master)](https://travis-ci.org/pluralcom/eslint-config-plural)

## Getting Started

The linter requires eslint, and react, react-native eslint plugins, to install them run:
```
npm install eslint eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-native --save-dev
```
Our default export contains all of our ESLint rules, including ECMAScript 6+ and React. It requires `eslint`, `eslint-plugin-import`, `eslint-plugin-react`, and `eslint-plugin-jsx-a11y`. If you don't need React, see [base entry point](#base-entry-point).

Then install eslint-config-plural by runnig:
```
npm install eslint-config-plural --save-dev
```
If you use yarn, run `npm info "eslint-config-plural@latest" peerDependencies` to list the peer dependencies and versions, then run `yarn add --dev <dependency>@<version>` for each listed peer dependency. See below for npm instructions.

In your eslintrc (or its equivalent) add
```
...
"extends": "plural",
"plugins": [
"react",
"react-native"
],
...
```
1. Install the correct versions of each package, which are listed by the command:

```sh
npm info "eslint-config-plural@latest" peerDependencies
```

## Parents:
eslint-config-plural extends airbnb-base style guide, appending our artistic rules
If using **npm 5+**, use this shortcut

```sh
npx install-peerdeps --dev eslint-config-plural
```

If using **npm < 5**, Linux/OSX users can run

```sh
(
export PKG=eslint-config-plural;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
```

Which produces and runs a command like:

```sh
npm install --save-dev eslint-config-plural eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.#
```

If using **npm < 5**, Windows users can either install all the peer dependencies manually, or use the [install-peerdeps](https://github.com/nathanhleung/install-peerdeps) cli tool.

```sh
npm install -g install-peerdeps
install-peerdeps --dev eslint-config-plural
```
The cli will produce and run a command like:

```sh
npm install --save-dev eslint-config-plural eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.#
```

2. Add `"extends": "plural"` to your .eslintrc

## Lints:
- es6
- react
- react native
### Base entry point

Our default export contains all of our ESLint rules, including ECMAScript 6+ without React. It requires eslint and eslint-plugin-import.

1. follow the steps above
2. Add `"extends": "plural/base"` to your .eslintrc

## Parents:
eslint-config-plural extends [eslint-config-airbnb](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb) or [eslint-config-airbnb-base](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) style guide, appending our rules.

## Changelog
Check the [changelog](https://github.com/pluralcom/eslint-config-plural/releases) for version details.

## Improving this config

Consider adding test cases if you're making complicated rules changes, like anything involving regexes. Perhaps in a distant future, we could use literate programming to structure our README as test cases for our .eslintrc?

You can run tests with `npm test`.

You can make sure this module lints with itself using `npm run lint`.

<hr>

This Package is being maintained by [plural](https://plural.com)
Expand Down
7 changes: 7 additions & 0 deletions base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: [
'eslint-config-airbnb-base',
'./rules/base',
].map(require.resolve),
rules: {}
};
23 changes: 7 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
module.exports = {
extends: ['airbnb-base'].concat([
'./rules/plural',
'./rules/react/react',
'./rules/react/react-native',
]
.map(require.resolve)),
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
},
rules: {
strict: 'error',
},
extends: [
'eslint-config-airbnb',
'./rules/base',
'./rules/react',
'./rules/react-a11y',
].map(require.resolve),
rules: {}
};
110 changes: 49 additions & 61 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,91 +1,79 @@
{
"name": "eslint-config-plural",
"version": "0.1.0",
"description": "ESLint shareable config for the Plural JavaScript code art.",
"version": "0.2.0",
"description": "🎨 How plural paints its code.",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/pluralcom/eslint-config-plural.git"
},
"author": {
"name": "Plural",
"email": "[email protected]",
"url": "https://plural.com"
},
"contributors": [
{
"name": "Ahmed Tarek",
"email": "[email protected]",
"url": "https://github.com/A-Tokyo"
}
],
"scripts": {
"prelint": "editorconfig-tools check * rules/* test/*",
"lint": "eslint .",
"pretests-only": "node ./test/requires",
"tests-only": "babel-tape-runner ./test/test-*.js",
"prepublish": "(not-in-publish || npm test) && safe-publish-latest",
"pretest": "npm run --silent lint",
"test": "npm run --silent tests-only",
"travis": "npm run --silent test"
},
"files": [
"index.js",
"rules/"
],
"repository": {
"type": "git",
"url": "https://github.com/pluralcom/eslint-config-plural"
},
"keywords": [
"plural",
"react",
"react-native",
"code",
"quality",
"style",
"lint",
"linter",
"jscs",
"jshint",
"jslint",
"eslint",
"validate",
"code style",
"strict",
"check",
"checker",
"verify",
"enforce",
"hint"
"eslintconfig",
"config",
"airbnb",
"javascript",
"styleguide",
"es2015",
"es2016",
"es2017",
"es2018",
"plural"
],
"author": {
"name": "Ahmed Tarek",
"email": "[email protected]",
"url": "https://github.com/A-Tokyo"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/pluralcom/eslint-config-plural/issues"
},
"homepage": "https://github.com/pluralcom/eslint-config-plural#readme",
"homepage": "https://github.com/pluralcom/eslint-config-plural",
"dependencies": {
"eslint": "^3.17.1",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-react-native": "^1.0.0"
"eslint-config-airbnb": "^17.0.0",
"eslint-config-airbnb-base": "^13.0.0",
"object.assign": "^4.1.0",
"object.entries": "^1.0.4"
},
"devDependencies": {
"eslint": "^3.15.0",
"tape": "^4.6.3",
"babel-preset-airbnb": "^2.2.3",
"babel-preset-airbnb": "^2.5.1",
"babel-tape-runner": "^2.0.1",
"editorconfig-tools": "^0.1.1",
"eslint": "^3.17.1",
"eslint-find-rules": "^1.14.3",
"eslint-plugin-import": "^2.2.0",
"eslint": "^4.19.1",
"eslint-find-rules": "^3.3.1",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.10.0",
"in-publish": "^2.0.0",
"react": ">= 0.13.0",
"safe-publish-latest": "^1.1.1",
"tape": "^4.6.3"
"tape": "^4.9.1"
},
"peerDependencies": {
"eslint": ">=3.15.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-react-native": "^1.0.0"
"eslint": "^4.19.1",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.10.0"
},
"engines": {
"node": ">= 4"
}
},
"contributors": [
{
"name": "Ahmed Tarek",
"email": "[email protected]",
"url": "https://github.com/A-Tokyo"
}
]
}
8 changes: 8 additions & 0 deletions rules/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
rules: {
camelcase: 0,
'no-underscore-dangle': 0,
'arrow-parens': 0,
'no-confusing-arrow': 0,
},
};
Loading

0 comments on commit 8ebacad

Please sign in to comment.