Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Added RN Stylesheet rational
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Mullins committed Dec 12, 2020
1 parent 9c5fd9c commit a44c91e
Show file tree
Hide file tree
Showing 31 changed files with 2,577 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{*.json,*.yml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
!.eslintrc.base.js
!.eslintrc.js
!.prettierrc.js
!jest.config.js
node_modules/
dist/
30 changes: 30 additions & 0 deletions .eslintrc.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
env: {
node: true,
},
extends: [
'eslint:recommended',
],
parserOptions: {
ecmaVersion: 8,
sourceType: 'module',
},
plugins: [
'prettier',
],
settings: {
'import/resolver': {
'typescript': {},
'node': {
'extensions': ['.js', '.ts'],
'paths': ['node_modules/', 'node_modules/@types'],
},
},
},
rules: {
// 'import/no-extraneous-dependencies': [2, { 'devDependencies': ['**/test.ts'] }],
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'quotes': ['error', 'single'],
},
};
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: ['./.eslintrc.base.js'],
rules: {
'no-prototype-builtins': 'off',
},
};
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

jobs:

unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
- run: npm run test

coverage:
name: Jest coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
- uses: dkershner6/jest-coverage-commenter-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
test_command: npm run test:ci
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## @public-js/eslint-plugin

/.git
/.svn
/.idea
/.vscode
.gitattributes
.npmrc
/dist

/node_modules
/jspm_packages
/.yarn
/.pnp
/vendor
.pnp.js
package-lock.json

.nyc_output
.grunt
/coverage

# logs
.firebase
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# misc
*~
*.lnk
.DS_Store
[Dd]esktop.ini
Thumbs.db*
.env.local
.env.development.local
.env.test.local
.env.production.local
49 changes: 49 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## @public-js/eslint-plugin

.editorconfig
.eslintignore
.eslintrc.base.js
.eslintrc.js
.gitignore
.npmignore
.prettierrc.js
jest.config.js
tsconfig.base.json
tsconfig.json
CODE_OF_CONDUCT.md
CONTRIBUTING.md

/.git
/.svn
/.idea
/.vscode
/.github
.gitattributes
.npmrc

/node_modules
/jspm_packages
/.yarn
/.pnp
/vendor
.pnp.js
package-lock.json

.nyc_output
.grunt
/coverage

# logs
.firebase
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# misc
*~
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
11 changes: 11 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
semi: true,
trailingComma: 'es5',
singleQuote: true,
printWidth: 110,
proseWrap: 'never',
endOfLine: 'lf',
tabWidth: 4,
useTabs: false,
bracketSpacing: true
};
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# @public-js/pluralize

[![CI](https://img.shields.io/github/workflow/status/public-js/eslint-plugin/CI?style=flat-square)](https://github.com/public-js/pluralize/actions?query=workflow%3ACI)
[![Downloads](https://img.shields.io/npm/dm/@public-js/eslint-plugin?style=flat-square)](https://www.npmjs.com/package/@public-js/pluralize)
[![Version](https://img.shields.io/npm/v/@public-js/eslint-plugin?style=flat-square)](https://www.npmjs.com/package/@public-js/pluralize)
[![License](https://img.shields.io/npm/l/@public-js/eslint-plugin?style=flat-square)](https://www.npmjs.com/package/@public-js/pluralize)

---

Helpful ESLint rules especially for those using TypeScript.


## Getting Started

Add the required packages to your project by running:
```shell
npm install eslint typescript @typescript-eslint/parser @public-js/eslint-plugin --save-dev
```

Then configure ESLint as you wish.

And finally add the following to your `eslintrc` file (or just modify the required properties):
```javascript
// ...
parser: '@typescript-eslint/parser'
// ...
parserOptions: {
ecmaFeatures: { jsx: true }
}
// ...
plugins: ['@public-js'] // append this plugin, don't replace everything
// ...
```


## Rules

#### rn-stylesheet-rational
Sorting React Native Stylesheet's properties in rational order

Usage:
```javascript
'@public-js/rn-stylesheet-rational': ['warn', { borderInBoxModel: false }]
```
20 changes: 20 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

// @ts-check
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
globals: {
'ts-jest': {
isolatedModules: true,
},
},
testEnvironment: 'node',
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: './tests/.+\\.test\\.ts$',
collectCoverage: false,
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
coverageReporters: ['text-summary', 'lcov'],
};
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "@public-js/eslint-plugin",
"version": "0.0.1",
"description": "Helpful ESLint rules especially for those using TypeScript",
"scripts": {
"build": "npm run clean && tsc -b tsconfig.build.json",
"clean": "rimraf dist",
"test:ci": "jest --ci --maxWorkers=3 --coverage --json --outputFile=jest.results.json",
"test": "jest",
"ts:watch": "tsc -w --preserveWatchOutput",
"npm-pub:test": "npm run build && npm publish --access public --dry-run",
"npm-pub": "npm run build && npm publish --access public"
},
"main": "dist/index.js",
"dependencies": {
"eslint-plugin-react-native-globals": ">=0.1.1",
"tsutils": "^3.17.1"
},
"devDependencies": {
"@types/jest": "^26.0.10",
"@types/marked": "^1.1.0",
"@types/node": "^14.6.0",
"@types/prettier": "*",
"@typescript-eslint/experimental-utils": "^4.8.2",
"chalk": "^4.0.0",
"eslint": "^7.8.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-json": "^2.1.2",
"eslint-plugin-prettier": "^3.1.4",
"marked": "^1.0.0",
"prettier": "^2.1.1",
"rimraf": "^3.0.0",
"typescript": "~4.1.2"
},
"peerDependencies": {
"@typescript-eslint/parser": "^4.0.0",
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0"
},
"files": [
"dist"
],
"license": "MIT",
"author": "Public JS <[email protected]> (https://github.com/public-js/public-js)",
"bugs": {
"url": "https://github.com/public-js/eslint-plugin/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/public-js/eslint-plugin.git"
},
"homepage": "https://github.com/public-js/eslint-plugin",
"engines": {
"node": ">=10.3.0"
}
}
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import rules from './rules';

export = { rules };
5 changes: 5 additions & 0 deletions src/rules/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import rnStylesheetRational from './rn-stylesheet-rational';

export default {
'rn-stylesheet-rational': rnStylesheetRational,
};
Loading

0 comments on commit a44c91e

Please sign in to comment.