Skip to content

Commit

Permalink
First public release (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mangs committed Dec 6, 2023
1 parent b09d65a commit 5e4d896
Show file tree
Hide file tree
Showing 36 changed files with 5,194 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
open-pull-requests-limit: 1
schedule:
interval: "weekly"
1 change: 1 addition & 0 deletions .github/pull_request_template.md
27 changes: 27 additions & 0 deletions .github/workflows/publishWorkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Workflow
on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- id: super-cache
uses: mangs/super-cache-action@v3
- if: steps.super-cache.outputs.cache-hit != 'true'
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}

# Task execution
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ github.token }}
- uses: mangs/simple-release-notes-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/pullRequestWorkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pull Request Workflow
on: pull_request

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- id: super-cache
uses: mangs/super-cache-action@v3
- if: steps.super-cache.outputs.cache-hit != 'true'
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}

# Task execution
- run: npm run validate:formatting
- run: npm run validate:linting:eslint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
node_modules
1 change: 1 addition & 0 deletions .npmrc
1 change: 1 addition & 0 deletions .prettierignore
1 change: 1 addition & 0 deletions .prettierrc.json
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0

- First public release
60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

You can ping the OSS committee via @babbel/oss on github

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers, if it applies, in any examples files and the [README.md](./README.md) to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
4. Pull Request will be merged by the code owner of the project

## Code of Conduct

### Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

### Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

### Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

### Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team via issues, or pinging on Github through @babbel/oss. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

### Attribution

This Code of Conduct is adapted from the Contributor Covenant homepage, version 1.4, available at
[homepage](http://contributor-covenant.org)
[version 1.4](http://contributor-covenant.org/version/1/4/)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Babbel

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.
13 changes: 13 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## These are the current project maintainers

Please keep the list sorted alphabetically by handle

| Github ID | Name | Email |
| ---------------------------------- | ----------------- | ----------------------- |
| [@mangs](https://github.com/mangs) | Eric L. Goldstein | <egoldstein@babbel.com> |

## These are the prior project maintainers

| Github ID | Name | Email |
| --------- | ---- | ----- |
| N/A | N/A | N/A |
149 changes: 147 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,147 @@
# eslint-config
Hierarchical ESLint configuration collection that intends to be simple to use, layered, and shared with others
# NPM module `@babbel/eslint-config`

Hierarchical ESLint configuration collection that intends to be simple to use, layered, and shared with others. [(project maintainers)](./MAINTAINERS.md)

## ESLint Configurations

There are multiple configurations you can use in your projects listed below. These are meant to be used in combination with one another. Please note that the base configuration is used by all the others, so there's no need to include that in your configuration unless it's the only one you're using.

The configuration names specified below should be used as items in the `extends` array in your ESLint configuration file. Each configuration string is clickable to bring you to the configuration details.

**It is recommended to not use the `browser`, `isomorphic`, and/or `node` configs simultaneously**

- [`@babbel/eslint-config`](./lib/eslintBaseConfig.json): base configuration that all configurations inherit from
- [`@babbel/eslint-config/browser`](./lib/eslintBrowserConfig.json): for browser environments (**should always be last in your "extends" array**)
- [`@babbel/eslint-config/isomorphic`](./lib/eslintIsomorphicConfig.json): for isomorphic environments; in other words, using the browser and Node.js simultaneously on the same code (**should always be last in your "extends" array**)
- [`@babbel/eslint-config/jest`](./lib/eslintJestConfig.json): for testing environments using [Jest](https://jestjs.io/)
- [`@babbel/eslint-config/node`](./lib/eslintNodeConfig.json): for [Node.js](https://nodejs.org/) environments (**should always be last in your "extends" array**)
- [`@babbel/eslint-config/playwright`](./lib/eslintPlaywrightConfig.json): for testing environments using the [Playwright](https://playwright.dev/) test runner (not `jest-playwright`)
- [`@babbel/eslint-config/preact`](./lib/eslintPreactConfig.json): for [Preact](https://preactjs.com/) environments
- [`@babbel/eslint-config/preact-typescript`](./lib/eslintPreactTypescriptConfig.json): for [Preact](https://preactjs.com/) environments using [TypeScript](https://www.typescriptlang.org/)
- [`@babbel/eslint-config/react`](./lib/eslintReactConfig.json): for [React](https://react.dev/) environments
- [`@babbel/eslint-config/react-typescript`](./lib/eslintReactTypescriptConfig.json): for [React](https://react.dev/) environments using [TypeScript](https://www.typescriptlang.org/)
- [`@babbel/eslint-config/typescript`](./lib/eslintTypescriptConfig.json): for [TypeScript](https://www.typescriptlang.org/) environments

## Base Configuration Assumptions

- Airbnb style guide configurations used as a guide
- Extends the `recommended` configuration of the following plugins:
- `eslint-plugin-eslint-comments` ([documentation](https://mysticatea.github.io/eslint-plugin-eslint-comments/))
- `eslint-plugin-import` ([documentation](https://github.com/import-js/eslint-plugin-import#readme))
- `eslint-plugin-regexp` ([documentation](https://github.com/ota-meshi/eslint-plugin-regexp#readme))
- `eslint-plugin-unicorn` ([documentation](https://github.com/sindresorhus/eslint-plugin-unicorn#readme))
- Native ES module-style imports and exports

- Imports

- File extensions required like in the spec (e.g. `import { some } from './thing.mjs';`)
- Imports declared at the top of each file in ordered groups separated by an empty line

1. External (e.g. NPM packages) and Node.js built-in (e.g. `node:fs`) imports
2. Internal imports (e.g. from your `src/` directory)
3. Type imports (e.g. `import type ...`)

```js
// External Imports
import { copyFile } from 'node:fs/promises';
import React from 'react';

// Internal Imports
import { logger } from './logger.mjs';

// Type Imports
import type { APIGatewayProxyEvent, APIGatewayProxyStructuredResultV2 } from 'aws-lambda';
import type { LoginResponse } from './types.mts';
```

- Exports
- Use named exports not default exports
- Exports all in a single declaration at the bottom of each file (e.g. `export { ... }`)

- Prettier for file formatting; ESLint does not check for formatting

## Example Usage

Here are a few common use cases to get you familiar with using this collection. The following examples should be added to your `.eslintrc.json` file at the root of your repository.

### Browser Environment

```json
{ "extends": ["@babbel/eslint-config/browser"] }
```

Yep. That's it. 😀
Or if you want to add some custom rules:
```json
{
"extends": ["@babbel/eslint-config/browser"],
"rules": {
/* add your custom rules here */
}
}
```
### Node.js Environment
```json
{ "extends": ["@babbel/eslint-config/node"] }
```
I think you're getting the hang of it now...

### Browser Environment That Uses React, TypeScript, Jest, and a Custom Rule

```json
{
"extends": ["@babbel/eslint-config/react-typescript", "@babbel/eslint-config/browser"],
"rules": {
"no-console": "off"
},
"overrides": [
{
"files": ["**/*.test.ts"],
"extends": "@babbel/eslint-config/jest"
}
]
}
```

## Making Your Own Config From the Base Config 🎓

```json
{
"extends": ["@babbel/eslint-config"],
"rules": {
/* add all your custom rules here */
}
}
```

The config export `@babbel/eslint-config` maps to the base config file `lib/eslintBaseConfig.json`. You can see how this works by looking for the `"."` entry in the `exports` section of this project's [`package.json`](./package.json); that section defines all the config exports rather than using proxy files (e.g. `index.js`) at the root of the repository.
For example, if you want to add an export called `@babbel/eslint-config/example`, you would do the following:
- Create a new ESLint configuration file called `./lib/eslintExampleConfig.json` and set your preferred settings within.
- For the `/example` package export to work, we have to add a new entry in the `"exports"` section in `package.json`. For this example, we'll add

```json
{
"exports": {
...
"example": "./lib/eslintExampleConfig.json",
...
}
}
```

- File a pull request and wait for a project maintainer to review it. As a reminder, be sure that your new configuration extends `eslintBaseConfig.json` or a more specific configuration, otherwise the acceptance of your code contributions may be delayed.

## Final Thoughts

These are just a few examples. Any field in the ESLint configuration can be overridden, so you can customize these as much as you want. If you find yourself or your team using a configuration set over and over again, consider submitting it to make it part of this collection.

## Feedback Encouraged =D

If you have any suggestions for improvements, please send them our way. 📫
1 change: 1 addition & 0 deletions config/eslint/eslintConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "./lib/eslintNodeConfig.json" }
1 change: 1 addition & 0 deletions config/github/codeOwners
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @mangs
3 changes: 3 additions & 0 deletions config/github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Changes:**

- REPLACE_ME
1 change: 1 addition & 0 deletions config/npm/npmConfig.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
29 changes: 29 additions & 0 deletions config/prettier/prettierConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxSingleQuote": false,
"printWidth": 100,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false,
"vueIndentScriptAndStyle": false,

"overrides": [
{
"files": "*.{cjs,js,jsx,mjs,ts,tsx}",
"options": {
"singleQuote": true
}
}
]
}
1 change: 1 addition & 0 deletions config/prettier/prettierIgnore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
11 changes: 11 additions & 0 deletions config/vscode/vscodeProjectConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"checkJs": false,
"module": "es2022",
"target": "es2023"
},
"exclude": ["build", "dist", "node_modules"],
"typeAcquisition": {
"include": ["jest"]
}
}
1 change: 1 addition & 0 deletions jsconfig.json
Loading

0 comments on commit 5e4d896

Please sign in to comment.