-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 71f92f3
Showing
8 changed files
with
351 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
|
||
# change these settings to your own preference | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{markdown,md}] | ||
trim_trailing_whitespace = false | ||
|
||
[{package,bower}.json] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# Force JavaScript settings to match ESLint rules | ||
[*.{js,jsx}] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes | ||
# https://git-scm.com/docs/gitattributes | ||
# https://github.com/alexkaratarakis/gitattributes/blob/master/Web.gitattributes | ||
* text=auto | ||
|
||
# Enforce Unix newlines | ||
*.js text eol=lf | ||
*.json text eol=lf | ||
*.markdown text eol=lf | ||
*.md text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# TELL GIT TO IGNORE STUFF | ||
# Doesn't work on anything already under version control. | ||
# https://git-scm.com/docs/gitignore | ||
|
||
# Ignore the following files and directories at any depth relative to the | ||
# directory this `.gitignore` file is currently located in. | ||
**/node_modules | ||
|
||
# Numerous always-ignore extensions | ||
*.diff | ||
*.err | ||
*.log | ||
*.orig | ||
*.swp | ||
*.zip | ||
*~ | ||
|
||
# OS or Editor folders | ||
# OS | ||
# https://github.com/github/gitignore/blob/master/Global/Linux.gitignore | ||
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore | ||
# https://github.com/github/gitignore/blob/master/Global/Windows.gitignore | ||
# | ||
# Editor | ||
# https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore | ||
# https://github.com/github/gitignore/blob/master/Global/Espresso.gitignore | ||
# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore | ||
# https://github.com/github/gitignore/blob/master/Global/NetBeans.gitignore | ||
# https://github.com/github/gitignore/blob/master/Global/SublimeText.gitignore | ||
# https://github.com/github/gitignore/blob/master/Global/TextMate.gitignore | ||
**/._* | ||
**/.DS_Store | ||
**/*.DS_Store | ||
**/Thumbs.db | ||
.cache | ||
.idea | ||
.project | ||
.settings | ||
.tmproj | ||
*.esproj | ||
*.sublime-project | ||
*.sublime-workspace | ||
nbproject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# ============================================================================== | ||
# TELL NPM TO IGNORE STUFF | ||
# `.npmignore` files will override `.gitignore` files, so any content in | ||
# `.gitignore` that you want to reuse must be duplicated in this file. | ||
# | ||
# https://git-scm.com/docs/gitignore | ||
# | ||
# ------------------------------------------------------------------------------ | ||
# DETAILS | ||
# https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package | ||
# | ||
# Use a `.npmignore` file to keep stuff out of your package. If there's no | ||
# `.npmignore` file, but there is a `.gitignore` file, then npm will ignore the | ||
# stuff matched by the `.gitignore` file. If you want to include something that | ||
# is excluded by your `.gitignore` file, you can create an empty `.npmignore` | ||
# file to override it. Like **git**, **npm** looks for `.npmignore` and | ||
# `.gitignore` files in all subdirectories of your package, not only the root | ||
# directory. | ||
# | ||
# `.npmignore` files follow the same pattern rules as `.gitignore` files: | ||
# | ||
# - Blank lines or lines starting with `#` are ignored. | ||
# - Standard glob patterns work. | ||
# - You can end patterns with a forward slash `/` to specify a directory. | ||
# - You can negate a pattern by starting it with an exclamation point `!`. | ||
# | ||
# By default, the following paths and files are ignored, so there's no need to | ||
# add them to `.npmignore` explicitly: | ||
# | ||
# - .*.swp | ||
# - ._* | ||
# - .DS_Store | ||
# - .git | ||
# - .hg | ||
# - .npmrc | ||
# - .lock-wscript | ||
# - .svn | ||
# - .wafpickle-* | ||
# - config.gypi | ||
# - CVS | ||
# - npm-debug.log | ||
# | ||
# Additionally, everything in `node_modules` is ignored, except for bundled | ||
# dependencies. npm automatically handles this for you, so don't bother adding | ||
# `node_modules` to `.npmignore`. | ||
# | ||
# The following paths and files are never ignored, so adding them to | ||
# `.npmignore` is pointless: | ||
# | ||
# - package.json | ||
# - README (and its variants) | ||
# - CHANGELOG (and its variants) | ||
# - LICENSE / LICENCE | ||
# ============================================================================== | ||
|
||
|
||
# ============================================================================== | ||
# UNIQUE TO `.npmignore` | ||
# ------------------------------------------------------------------------------ | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
# ============================================================================== | ||
|
||
|
||
# ============================================================================== | ||
# COPIED FROM `.gitignore` | ||
# See `.gitignore` for comments and details. Don't explicitly include items | ||
# that are automatically handled by **npm** as described in the documentation. | ||
# ------------------------------------------------------------------------------ | ||
|
||
# Numerous always-ignore extensions | ||
*.diff | ||
*.err | ||
*.log | ||
*.orig | ||
*.swp | ||
*.zip | ||
*~ | ||
|
||
# OS or Editor folders | ||
**/Thumbs.db | ||
.cache | ||
.idea | ||
.project | ||
.settings | ||
.tmproj | ||
*.esproj | ||
*.sublime-project | ||
*.sublime-workspace | ||
nbproject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": true, | ||
"jsxSingleQuote": false, | ||
"printWidth": 80, | ||
"quoteProps": "as-needed", | ||
"semi": false, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "none", | ||
"useTabs": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2019, Nick Petruzzelli | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# prettier-config-standard | ||
|
||
A Prettier [shareable config](https://prettier.io/docs/en/configuration.html#sharing-configurations ) | ||
for projects using **[Prettier](https://prettier.io/ )** and | ||
**[JavaScript Standard Style](https://standardjs.com/ )** as ESLint rules or | ||
separate processes. | ||
|
||
## Installation | ||
|
||
``` | ||
npm install --save-dev prettier-config-standard | ||
``` | ||
|
||
_This is only a shareable configuration. It does not install Prettier, Standard, | ||
ESLint, or any other part of the tool chain._ | ||
|
||
## Usage | ||
|
||
Reference it in `package.json` using the `prettier` property: | ||
|
||
```json | ||
{ | ||
"name": "my-projects-name", | ||
"prettier": "prettier-config-standard", | ||
"devDependencies" : { | ||
"prettier-config-standard": "^1.0.0" | ||
} | ||
} | ||
``` | ||
|
||
If you don't want to use `package.json`, you can use any of the supported | ||
extensions to export a string: | ||
|
||
```jsonc | ||
// `.prettierrc.json` | ||
"prettier-config-standard" | ||
``` | ||
|
||
```javascript | ||
// `prettier.config.js` or `.prettierrc.js` | ||
module.exports = 'prettier-config-standard' | ||
``` | ||
|
||
## Extending Shared Configurations | ||
|
||
This configuration is not intended to be changed, but if you have a setup where | ||
modification is required, it is possible. Prettier does not offer an "extends" | ||
mechanism as you might be familiar from tools such as ESLint. | ||
|
||
To extend a configuration you will need to: | ||
|
||
1. Import/Require this sharable config from within your own configuration. This | ||
means you must be using a JavaScript version of a Prettier configuration | ||
file. | ||
2. Extend your modification on top of the shared config using something like | ||
**[Object destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment )**, | ||
**[Object.assign()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign )**, | ||
or **[lodash.merge()](https://lodash.com/docs/4.17.11#merge )** | ||
3. Export the modified configuration | ||
|
||
> Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for | ||
> configuration file support. This means you can configure prettier via: | ||
> | ||
> - A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json`. | ||
> - A `.prettierrc.toml` file, written in TOML (the `.toml` extension is _required_). | ||
> - A `prettier.config.js` or `.prettierrc.js` file that exports an object. | ||
> - A `"prettier"` key in your `package.json` file. | ||
> | ||
> ... | ||
> | ||
> **Sharing configurations** | ||
> | ||
> > Note: This method does **not** offer a way to _extend_ the configuration to | ||
> > overwrite some properties from the shared configuration. If you need to do | ||
> > that, import the file in a `.prettierrc.js` file and export the | ||
> > modifications, e.g: | ||
> > | ||
> > ```js | ||
> > module.exports = { | ||
> > ...require("@company/prettier-config"), | ||
> > semi: false | ||
> > }; | ||
> > ``` | ||
> | ||
> _source: <https://github.com/prettier/prettier/blob/cacaa92a3f0acf9618f54cd60c9b36b37744dbde/docs/configuration.md>_ | ||
For example, if you need to change it so that semicolons are required: | ||
```javascript | ||
// `prettier.config.js` or `.prettierrc.js` | ||
const prettierConfigStandard = require('prettier-config-standard') | ||
const merge = require('lodash.merge') | ||
const modifiedConfig = merge( | ||
{}, | ||
prettierConfigStandard, | ||
{ | ||
semi: true, | ||
// ... other modified settings here | ||
} | ||
) | ||
module.exports = modifiedConfig | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "prettier-config-standard", | ||
"version": "1.0.0", | ||
"description": "A Prettier shareable config for projects using 'Prettier' and 'JavaScript Standard Style' as ESLint rules or separate processes.", | ||
"main": ".prettierrc.json", | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:npetruzzelli/config-prettier-standard.git" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"eslintconfig", | ||
"eslint-config", | ||
"eslintplugin", | ||
"eslint-plugin", | ||
"JavaScript Standard Style", | ||
"jsstandard", | ||
"lint", | ||
"prettier", | ||
"prettierconfig", | ||
"prettier-config", | ||
"standard", | ||
"standard style" | ||
], | ||
"author": "Nick Petruzzelli <[email protected]>", | ||
"license": "BSD-3-Clause" | ||
} |