Skip to content

Commit

Permalink
feat: Add a shared Stylus configuration to build cozy application
Browse files Browse the repository at this point in the history
This configuration is copied from cozy-scripts

Because we are migrating our app bundler from create-cozy-app to
Rsbuild, we will remove dependences to cozy-script from our app and so
we will lose access to the embeded .stylintrc file

To prevent this we want to extract this `.stylintrc` file to its own
config repository. Then Rsbuild project will be able to use it by
installing `stylus-config-cozy-app` module
  • Loading branch information
Ldoppea authored and zatteo committed Feb 7, 2025
1 parent 3dce429 commit f7016b4
Show file tree
Hide file tree
Showing 5 changed files with 456 additions and 21 deletions.
120 changes: 120 additions & 0 deletions config/stylus-config-cozy-app/.stylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"blocks": "never",
"brackets": {
"expect": "never",
"error": true
},
"colons": {
"expect": "never",
"error": true
},
"colors": {
"expect": "always",
"error": true
},
"commaSpace": {
"expect": "always",
"error": true
},
"commentSpace": {
"expect": "always",
"error": true
},
"cssLiteral": "never",
"customProperties": [],
"depthLimit": 4,
"duplicates": {
"expect": true,
"error": true
},
"efficient": {
"expect": "always",
"error": true
},
"exclude": [],
"extendPref": "@extend",
"globalDupe": {
"expect": true,
"error": true
},
"groupOutputByFile": {
"expect": true,
"error": true
},
"indentPref": {
"expect": 4,
"error": true
},
"leadingZero": {
"expect": "never",
"error": true
},
"maxErrors": false,
"maxWarnings": false,
"mixed": {
"expect": true,
"error": true
},
"mixins": ["top-padded","right-padded","bottom-padded","left-padded","vertically-padded","horizontally-padded","padded","top-spaced","right-spaced","bottom-spaced","left-spaced","vertically-spaced","horizontally-spaced","spaced","hide","reset"],
"namingConvention": {
"expect": "lowercase-dash",
"error": true
},
"namingConventionStrict": false,
"none": {
"expect": "never",
"error": true
},
"noImportant": {
"expect": true,
"error": true
},
"parenSpace": {
"expect": "never",
"error": true
},
"placeholders": {
"expect": "always",
"error": true
},
"prefixVarsWithDollar": false,
"quotePref": {
"expect": "single",
"error": true
},
"reporterOptions": {
"columns": ["lineData", "severity", "description", "rule"],
"columnSplitter": " ",
"showHeaders": false,
"truncate": true
},
"semicolons": {
"expect": "never",
"error": true
},
"sortOrder": false,
"stackedProperties": {
"expect": "never",
"error": true
},
"trailingWhitespace": {
"expect": "never",
"error": true
},
"universal": {
"expect": "never",
"error": true
},
"valid": {
"expect": true,
"error": true
},
"zeroUnits": {
"expect": "never",
"error": true
},
"zIndexNormalize": {
"expect": 1,
"error": true
}
}
21 changes: 21 additions & 0 deletions config/stylus-config-cozy-app/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017-present, Cozy Cloud

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.
23 changes: 23 additions & 0 deletions config/stylus-config-cozy-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<h1 align="center">Stylus Config Cozy App</h1>

## What's rsbuild-config-cozy-app?

An opinionated configurations for [Stylus](https://stylus-lang.com/) to build Cozy Applications.

## Quick Start

To install:

```bash
yarn add -D stylus-config-cozy-app
```

Add `scripts` inside your `package.json` file as follows:

```json
"scripts": {
"lint:styles": "stylint src --config ./node_modules/stylus-config-cozy-app/.stylintrc"
}
```

You can now lint your application's stylus files using `yarn lint:styles`
26 changes: 26 additions & 0 deletions config/stylus-config-cozy-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "stylus-config-cozy-app",
"version": "0.0.0",
"description": "Stylus config for Cozy Application (Cozy Cloud)",
"author": "Cozy Cloud",
"repository": {
"type": "git",
"url": "git+https://github.com/cozy/cozy-libs.git"
},
"homepage": "https://github.com/cozy/cozy-libs/tree/master/config/stylus-config-cozy-app",
"license": "MIT",
"bugs": {
"url": "https://github.com/cozy/cozy-libs/issues"
},
"files": [
".stylintrc"
],
"devDependencies": {
"stylint": "1.5.9"
},
"dependencies": {
},
"peerDependencies": {
"stylint": ">=1.5.9"
}
}
Loading

0 comments on commit f7016b4

Please sign in to comment.