Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First public release #1

Merged
merged 7 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
24 changes: 24 additions & 0 deletions .github/workflows/publishWorkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Workflow
on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: CPU Details
run: lscpu
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.1.34"
- uses: mangs/simple-release-notes-action@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
should_auto_update_major_tag: false
- uses: JS-DevTools/npm-publish@v3
with:
access: public
registry: https://registry.npmjs.org/
token: ${{ secrets.NPM_USER_ACCESS_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/pullRequestWorkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pull Request Workflow
on: pull_request

jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: CPU Details
run: lscpu
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.1.34"
- run: bun install --frozen-lockfile
- run: bun run check:environment
# - run: bun run check:package-version
# env:
# GITHUB_API_URL: ${{ env.GITHUB_API_URL }}
# GITHUB_REF_NAME: ${{ env.GITHUB_REF_NAME }}
# GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
# GITHUB_TOKEN: ${{ github.token }}
Comment on lines +16 to +21
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a convenience check during CI that will fail if the PR doesn't increment the package.json version and match the latest version in CHANGELOG.md. So instead of needing to remember to do it manually and having a reminder in the pull request template, it's now automated. However, since this is the first version being published, it doesn't work so needs to be disabled until the 2nd PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make a follow-up PR to turn this on

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we want this?

Forcing package version update for all merges may sound nice initially, but then it means no change can be merged without a release, which isn't ideal as there are valid changes that don't require releases, such as documentation only changes, local development only changes (local scripts, dev dependencies update).

It also prevents the ability of batching updates (though for this I think, given we have a low flow of contributions, it's also ok to use release branches)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it very useful. Documentation or local development changes can be a patch release. Plenty of open source packages follow this philosophy. I see more upsides than downsides mainly because it makes the publishing process more foolproof and less error prone; in other words, you don't have to tell people what to do, it does it for you.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I understand the benefits, I am personally not a big fan of libraries having releases for changes that don't affect end users, but definitely more an opinion than anything so all good.

- run: bun --bun run check:formatting
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 .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/)
107 changes: 105 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,105 @@
# stylelint-config
Hierarchical Stylelint configuration collection that intends to be simple to use, layered, and shared with others
# NPM module `@babbel/stylelint-config`

Hierarchical Stylelint configuration collection that intends to be simple to use, layered, and shared with others [[maintainers]](/config/github/codeOwners)

## Stylelint Configurations

If you're unfamiliar with [Stylelint](https://stylelint.io), it works similarly to [ESLint](https://eslint.org) with some minor but unique changes in configuration syntax. You can read more about those [differences here](https://stylelint.io/user-guide/configure).

There are multiple configurations you can use in your projects listed below. 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 Stylelint configuration file. Each configuration string is clickable to bring you to the configuration details.

- [`@babbel/stylelint-config`](./lib/stylelintBaseConfig.json): base configuration that all configurations inherit from
- [`@babbel/stylelint-config/css`](./lib/stylelintCssConfig.json): for pure CSS-based stylesheets
- [`@babbel/stylelint-config/css-modules`](./lib/stylelintCssModulesConfig.json): for CSS module-based stylesheets
- [`@babbel/stylelint-config/scss`](./lib/stylelintScssConfig.json): for SCSS-based stylesheets
- [`@babbel/stylelint-config/scss-modules`](./lib/stylelintScssModulesConfig.json): for SCSS module-based stylesheets
- [`@babbel/stylelint-config/styled-components`](./lib/stylelintStyledComponentsConfig.json): for styled-components

## Configuration Assumptions

- Similar to Prettier, these configurations are highly-opinionated, but unlike Prettier they are all customizable
- This is meant to minimize decision paralysis and promote a common baseline
- Modern, performant features are enforced
- Browser incompatibilities are proactively avoided if you use [browserslist](https://github.com/browserslist/browserslist) with your project

## Example Usage

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

### CSS-based Stylesheets

```jsonc
{ "extends": "@babbel/stylelint-config/css" }
```

Yep. That's it. 😀

Or if you want to add some custom rules:

```jsonc
{
"extends": "@babbel/stylelint-config/css",
"rules": {
/* add your custom rules here */
},
}
```

### CSS Module-based Stylesheets

```jsonc
{ "extends": "@babbel/stylelint-config/css-modules" }
```

I think you're getting the hang of it now...

### SCSS-based Stylesheets and a Custom Rule

```jsonc
{
"extends": "@babbel/stylelint-config/scss",
"rules": {
"custom-property-pattern": "[a-z]+[a-zA-Z]*",
},
}
```

## Making Your Own Config From the Base Config 🎓

```jsonc
{
"extends": "@babbel/stylelint-config",
"rules": {
/* add all your custom rules here */
},
}
```

The config export `@babbel/stylelint-config` maps to the base config file `lib/stylelintBaseConfig.json`. You can see how this works by looking for the `"."` entry in the `exports` section of `package.json`; that section defines all the config exports rather than using proxy files such as `index.js` at the root of the repository.

For example, if you want to add an export called `@babbel/stylelint-config/example`, you would do the following:

- Create a new Stylelint configuration file called `./lib/stylelintExampleConfig.json` and set your preferred settings within.
- For the `/example` package export to work, add a new entry in the `"exports"` section in `package.json`:

```jsonc
{
"exports": {
/* ... */
"example": "./lib/stylelintExampleConfig.json",
/* ... */
},
}
```

- File a pull request. Be sure to at least extend from `lib/stylelintBaseConfig.json` or one of the more specific configs, otherwise the addition of your contribution to the project may be delayed.

## Final Thoughts

These are just a few examples. Any configuration option in any Stylelint 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 🙂

If you have any suggestions for improvements, please send them our way. We're interested in your ideas. 📫
Binary file added bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions bunfig.toml
3 changes: 3 additions & 0 deletions config/bun/bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[install]
auto = "disable"
exact = true
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 @jduthon @pooja-salpekar @Jhojan28 @serenematt-babbel @laurensortiz-babbel
8 changes: 8 additions & 0 deletions config/github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**Pull Request Checklist**

- [ ] I have read the [CONTRIBUTING](/CONTRIBUTING.md) document
- [ ] Readme and changelog updates were made reflecting this PR's changes

**Changes Included**

- REPLACE_ME
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,cts,js,jsx,mjs,mts,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
67 changes: 67 additions & 0 deletions lib/stylelintBaseConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up not making any changes to the config files. The main change was updating the dependency versions to latest.

"plugins": [
"stylelint-declaration-block-no-ignored-properties",
"stylelint-high-performance-animation",
"stylelint-no-unsupported-browser-features",
"stylelint-order",
"stylelint-suitcss"
],
"defaultSeverity": "error",
"reportDescriptionlessDisables": true,
"reportInvalidScopeDisables": true,
"reportNeedlessDisables": true,
"rules": {
"declaration-block-no-duplicate-properties": [true, { "ignoreProperties": ["composes"] }],
"declaration-property-value-no-unknown": true,
"order/order": [
[
{ "type": "at-rule", "name": "forward" },
{ "type": "at-rule", "name": "use" },
{ "type": "at-rule", "name": "mixin" },
{ "type": "at-rule", "name": "include" },
{ "type": "at-rule", "name": "function" },
{ "type": "at-rule", "name": "charset" },
{ "type": "at-rule", "name": "layer" },
{ "type": "at-rule", "name": "import" },
{ "type": "at-rule", "name": "extend" },
{ "type": "at-rule", "name": "namespace" },
{ "type": "at-rule", "name": "property" },
{ "type": "at-rule", "name": "color-profile" },
{ "type": "at-rule", "name": "counter-style" },
{ "type": "at-rule", "name": "document" },
{ "type": "at-rule", "name": "font-face" },
{ "type": "at-rule", "name": "font-feature-values" },
{ "type": "at-rule", "name": "font-palette-values" },
{ "type": "at-rule", "name": "keyframes" },
{ "type": "at-rule", "name": "page" },
{ "type": "at-rule", "name": "at-root" },
{ "type": "at-rule", "name": "error" },
{ "type": "at-rule", "name": "warn" },
{ "type": "at-rule", "name": "debug" },
{ "type": "at-rule", "name": "if" },
{ "type": "at-rule", "name": "else" },
{ "type": "at-rule", "name": "each" },
{ "type": "at-rule", "name": "for" },
{ "type": "at-rule", "name": "while" },
{ "type": "at-rule", "name": "each" },
"at-variables",
"dollar-variables",
"custom-properties",
"less-mixins",
"declarations",
"rules",
{ "type": "at-rule", "name": "container" },
{ "type": "at-rule", "name": "media" },
{ "type": "at-rule", "name": "supports" }
],
{ "unspecified": "bottom" }
],
"order/properties-alphabetical-order": true,
"plugin/declaration-block-no-ignored-properties": true,
"plugin/no-low-performance-animation-properties": true,
"plugin/no-unsupported-browser-features": true,
"suitcss/custom-property-no-outside-root": true,
"suitcss/root-no-standard-properties": true,
"suitcss/selector-root-no-composition": true
}
}
3 changes: 3 additions & 0 deletions lib/stylelintCssConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["stylelint-config-standard", "./stylelintBaseConfig.json"]
}
7 changes: 7 additions & 0 deletions lib/stylelintCssModulesConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["./stylelintCssConfig.json", "stylelint-config-css-modules"],
"rules": {
"order/properties-alphabetical-order": null,
"order/properties-order": [["composes"], { "unspecified": "bottomAlphabetical" }]
}
}
6 changes: 6 additions & 0 deletions lib/stylelintScssConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["stylelint-config-standard-scss", "./stylelintBaseConfig.json"],
"rules": {
"scss/selector-no-redundant-nesting-selector": [true, { "ignoreKeywords": ["when"] }]
}
}
7 changes: 7 additions & 0 deletions lib/stylelintScssModulesConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["./stylelintScssConfig.json", "stylelint-config-css-modules"],
"rules": {
"order/properties-alphabetical-order": null,
"order/properties-order": [["composes"], { "unspecified": "bottomAlphabetical" }]
}
}
4 changes: 4 additions & 0 deletions lib/stylelintStyledComponentsConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["stylelint-config-standard", "./stylelintBaseConfig.json"],
"customSyntax": "postcss-styled-syntax"
}
Loading