Skip to content

Commit

Permalink
feat: more configs (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp authored Dec 14, 2022
1 parent 89ee0b7 commit 07f3f0e
Show file tree
Hide file tree
Showing 52 changed files with 1,338 additions and 202 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: './packages/eslint-config',
extends: './packages/eslint-config',
};
2 changes: 1 addition & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "./packages/markdownlint-config/index.json"
"extends": "./packages/markdownlint-config/index.json"
}
66 changes: 33 additions & 33 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,49 @@ ignore: |

# Overwrite above default rules
rules:
braces:
# Defaults
# min-spaces-inside: 0
# max-spaces-inside: 0
braces:
# Defaults
# min-spaces-inside: 0
# max-spaces-inside: 0

# Keep 0 min-spaces to not error on empty {} collection definitions
min-spaces-inside: 0
# Keep 0 min-spaces to not error on empty {} collection definitions
min-spaces-inside: 0

# Allow one space inside braces to improve code readability
max-spaces-inside: 1
# Allow one space inside braces to improve code readability
max-spaces-inside: 1

brackets:
# Defaults
# min-spaces-inside: 0
# max-spaces-inside: 0
brackets:
# Defaults
# min-spaces-inside: 0
# max-spaces-inside: 0

# Keep 0 min-spaces to not error on empty [] collection definitions
min-spaces-inside: 0
# Keep 0 min-spaces to not error on empty [] collection definitions
min-spaces-inside: 0

# Allow one space inside braces to improve code readability
max-spaces-inside: 1
# Allow one space inside braces to improve code readability
max-spaces-inside: 1

colons:
# Defaults
# min-spaces-before: 0
# max-spaces-after: 1
colons:
# Defaults
# min-spaces-before: 0
# max-spaces-after: 1

# Allow multiple spaces after a colon to allow indentation of YAML
# dictionary values
max-spaces-after: -1
# Allow multiple spaces after a colon to allow indentation of YAML
# dictionary values
max-spaces-after: -1

commas:
# Defaults
# max-spaces-after: 1
commas:
# Defaults
# max-spaces-after: 1

# Allow multiple spaces after a comma to allow indentation of YAML
# dictionary values
max-spaces-after: -1
# Allow multiple spaces after a comma to allow indentation of YAML
# dictionary values
max-spaces-after: -1

comments:
require-starting-space: true
min-spaces-from-content: 1
comments:
require-starting-space: true
min-spaces-from-content: 1

line-length: disable
line-length: disable

...
129 changes: 129 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<br>

<div align="center">
<img width="456" src="https://raw.githubusercontent.com/wayofdev/npm-shareable-configs/master/assets/logo.gh-light-mode-only.png#gh-light-mode-only">
<img width="456" src="https://raw.githubusercontent.com/wayofdev/npm-shareable-configs/master/assets/logo.gh-dark-mode-only.png#gh-dark-mode-only">
</div>
<br>

<br>

<div align="center">
<a href="https://actions-badge.atrox.dev/wayofdev/npm-shareable-configs/goto"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fwayofdev%2Fnpm-shareable-configs%2Fbadge&style=flat-square"/></a>
<a href="https://github.com/wayofdev/npm-shareable-configs/tags"><img src="https://img.shields.io/github/v/tag/wayofdev/npm-shareable-configs?sort=semver&style=flat-square" alt="Latest Version"></a>
<a href="LICENSE.md"><img src="https://img.shields.io/github/license/wayofdev/npm-shareable-configs.svg?style=flat-square&color=blue" alt="Software License"/></a>
<a href="#"><img alt="Commits since latest release" src="https://img.shields.io/github/commits-since/wayofdev/npm-shareable-configs/latest?style=flat-square"></a>
</div>

<br>

# NPM Shareable Configs

This repository shareable configurations with fully automated package publishing to the `NPM` Registry.

<br>

## 🚀 Featured Packages

* browserslist-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Fbrowserslist-config%2Fpackage.json&style=flat-square)
* [browserslist/browserslist](https://github.com/browserslist/browserslist) — share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-preset-env

* commitlint-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Fcommitlint-config%2Fpackage.json&style=flat-square)
* [commitlint.js](https://commitlint.js.org/#/) — helps your team adhere to a commit convention.

* eslint-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Feslint-config%2Fpackage.json&style=flat-square)
* [eslint](https://eslint.org/) — statically analyzes your code to quickly find problems. It is built into most text editors and you can run ESLint as part of your continuous integration pipeline.

* htmlhint-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Fhtmlhint-config%2Fpackage.json&style=flat-square)
* [htmlhint](https://htmlhint.com) — static code analysis tool you need for your HTML

* lint-staged-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Flint-staged-config%2Fpackage.json&style=flat-square)
* [lint-staged](https://github.com/okonet/lint-staged) — run linters on git staged files

* markdownlint-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Fmarkdownlint-config%2Fpackage.json&style=flat-square)
* [davidanson/markdownlint](https://github.com/DavidAnson/markdownlint) — a Node.js style checker and lint tool for Markdown/CommonMark files

* postcss-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Fpostcss-config%2Fpackage.json&style=flat-square)
* [postcss](https://postcss.org/) — add vendor prefixes to CSS rules using values from Can I Use. [Autoprefixer](https://github.com/postcss/autoprefixer) will use the data based on current browser popularity and property support to apply prefixes for you.

* prettier-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Fprettier-config%2Fpackage.json&style=flat-square)
* [prettier](https://prettier.io/) — an opinionated code formatter, supports many langauges

* secretlint-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Fsecretlint-config%2Fpackage.json&style=flat-square)
* [secretlint/secretlint](https://github.com/secretlint/secretlint) — pluggable linting tool to prevent committing credential

* stylelint-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Fsecretlint-config%2Fpackage.json&style=flat-square)
* [stylelint](https://stylelint.io) — a mighty, modern linter that helps you avoid errors and enforce conventions in your styles

* tsconfig-config ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/wayofdev/npm-shareable-configs?filename=packages%2Ftsconfig-config%2Fpackage.json&style=flat-square)
* [tsconfig](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) — typescript configuration for projects


<br>

## 💿 Installation

Install all configs and associated packages as development dependencies (**excludes** Webpack):

### → with yarn

```bash
$ yarn add -D \
browserslist \
@commitlint/cli \
eslint \
htmlhint \
lint-staged \
markdownlint \
postcss \
prettier \
secretlint \
stylelint \
typescript \
@wayofdev/browserslist-config \
@wayofdev/commitlint-config \
@wayofdev/eslint-config \
@wayofdev/htmlhint-config \
@wayofdev/lint-staged-config \
@wayofdev/markdownlint-config \
@wayofdev/postcss-config \
@wayofdev/prettier-config \
@wayofdev/secretlint-config \
@wayofdev/stylelint-config\
@wayofdev/tsconfig-config
```

### → with pnpm in monorepo

Execute in root dir of project:

```bash
$ pnpm add -Dw \
browserslist \
@commitlint/cli \
eslint \
htmlhint \
lint-staged \
markdownlint \
postcss \
prettier \
secretlint \
stylelint \
typescript \
@wayofdev/browserslist-config \
@wayofdev/commitlint-config \
@wayofdev/eslint-config \
@wayofdev/htmlhint-config \
@wayofdev/lint-staged-config \
@wayofdev/markdownlint-config \
@wayofdev/postcss-config \
@wayofdev/prettier-config \
@wayofdev/secretlint-config \
@wayofdev/stylelint-config\
@wayofdev/tsconfig-config
```

<br>

## 💻 Usage

2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['./packages/commitlint-config'],
extends: ['./packages/commitlint-config'],
};
6 changes: 3 additions & 3 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const config = require('./packages/lint-staged-config');
const ymlConfig = require('./packages/lint-staged-config/yml');

module.exports = {
'*': ['secretlint'],
...ymlConfig,
...config,
'*': ['secretlint'],
...ymlConfig,
...config,
};
21 changes: 21 additions & 0 deletions packages/browserslist-config/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Matthew Waldron

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File renamed without changes.
27 changes: 27 additions & 0 deletions packages/browserslist-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Browserslist Config

My personal shareable browserslist configuration.

## Install

```bash
yarn add -D @wayofdev/browserslist-config
```

## Usage

**`.browserslistrc`**

```bash
extends @wayofdev/browserslist-config
```

## Under The Hood

### `index.js`

- `browserslist`

## License

MIT
19 changes: 19 additions & 0 deletions packages/browserslist-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// based on Google's browserslist-config-google/modern
// https://github.com/awkaiser/browserslist-config-google/tree/2.0.0#alternative-configuration

const desktop = [
'last 2 Chrome major versions',
'last 2 Firefox major versions',
'last 2 Safari major versions',
'last 2 Edge major versions',
];

const mobile = [
'last 2 Android major versions',
'last 2 ChromeAndroid major versions',
'last 2 iOS major versions',
];

const supportedBrowsers = [...desktop, ...mobile];

module.exports = supportedBrowsers;
34 changes: 34 additions & 0 deletions packages/browserslist-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@wayofdev/browserslist-config",
"version": "1.0.0",
"description": "A shareable browserslist configuration for projects.",
"keywords": [
"browserslist",
"browserslist-config"
],
"author": "lotyp7@gmail.com",
"license": "MIT",
"bugs": {
"url": "https://github.com/wayofdev/npm-shareable-configs/issues"
},
"homepage": "https://github.com/wayofdev/npm-shareable-configs/tree/master/packages/browserslist-config#readme",
"main": "index.js",
"files": [
"index.js",
"scripts/*"
],
"scripts": {
"test": "echo \"No test specified\""
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/wayofdev/npm-shareable-configs.git",
"directory": "packages/browserslist-config"
},
"dependencies": {
"browserslist": "^4.21.4"
}
}
11 changes: 11 additions & 0 deletions packages/browserslist-config/scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable security/detect-non-literal-fs-filename */
const fs = require('node:fs');
const path = require('node:path');

const filePath = path.join(process.env.INIT_CWD, '.browserslistrc');

const fileConfigObject = 'extends @wayofdev/browserslist-config';

if (!fs.existsSync(filePath)) {
fs.writeFileSync(filePath, fileConfigObject);
}
3 changes: 0 additions & 3 deletions packages/commitizen-config/.czrc

This file was deleted.

Loading

0 comments on commit 07f3f0e

Please sign in to comment.