This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Mullins
committed
Dec 12, 2020
1 parent
9c5fd9c
commit a44c91e
Showing
31 changed files
with
2,577 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import rules from './rules'; | ||
|
||
export = { rules }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
Oops, something went wrong.