Skip to content

Commit

Permalink
Implement an ESLint config for React
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Aug 17, 2021
1 parent b7e762b commit bbf45aa
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 127 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/artifacts/
/dist/
/node_modules/
11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
module.exports = {
extends: [
'@snout',
'standard-jsx',
'standard-react',
],
rules: {
// no requirement for parens around multi-line JSX
'react/jsx-wrap-multilines': 'off',
// broken with react/jsx-wrap-multilines disabled, until https://github.com/yannickcr/eslint-plugin-react/issues/1466 is addressed
'react/jsx-closing-tag-location': 'off',
// no requirement for prop types
'react/prop-types': 'off',
},
}
19 changes: 0 additions & 19 deletions .github/workflows/ci-scheduled.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/ci.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/.makefiles/
/artifacts/
/dist/
/node_modules/
/yarn-error.log
/yarn.lock
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © REPLACE_ME Erin Millard
Copyright © 2021 Erin Millard

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 0 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
JS_SOURCE_FILES += $(shell find src -type f -iname "*.ts" 2> /dev/null)
_JS_TEST_ASSETS := $(shell find test -type f -not -iname "*.ts" 2> /dev/null)

################################################################################

-include .makefiles/Makefile
-include .makefiles/pkg/js/v1/Makefile
-include .makefiles/pkg/js/v1/with-yarn.mk

.makefiles/%:
@curl -sfL https://makefiles.dev/v1 | bash /dev/stdin "$@"

################################################################################

dist: rollup.config.js tsconfig.json node_modules $(JS_SOURCE_FILES)
rollup --config rollup.config.js

@touch "$@"
59 changes: 27 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
<!-- REPLACE_ME -->
# Snout template repo

<!-- Uncomment this section
# Snout ESLint configuration for React

[![Current version][badge-version-image]][badge-version-link]
[![Bundle size][badge-bundle-image]][badge-bundle-link]
[![Build status][badge-build-image]][badge-build-link]
[![Test coverage][badge-coverage-image]][badge-coverage-link]
[badge-build-image]: https://img.shields.io/github/workflow/status/snout-router/GITHUB_REPO_NAME/CI?style=for-the-badge
[badge-build-link]: https://github.com/snout-router/GITHUB_REPO_NAME/actions/workflows/ci.yml
[badge-bundle-image]: https://img.shields.io/bundlephobia/minzip/@snout/GITHUB_REPO_NAME?style=for-the-badge
[badge-bundle-link]: https://bundlephobia.com/result?p=@snout/GITHUB_REPO_NAME
[badge-coverage-image]: https://img.shields.io/codecov/c/gh/snout-router/GITHUB_REPO_NAME?style=for-the-badge
[badge-coverage-link]: https://codecov.io/gh/snout-router/GITHUB_REPO_NAME
[badge-version-image]: https://img.shields.io/npm/v/@snout/GITHUB_REPO_NAME?label=%40snout%2FGITHUB_REPO_NAME&logo=npm&style=for-the-badge
[badge-version-link]: https://npmjs.com/package/@snout/GITHUB_REPO_NAME
-->

This repository is a template for Snout TypeScript projects. After creating a
repository from this template, follow these steps:

- Uncomment the badges in this `README.md` file
- Replace the string `GITHUB_REPO_NAME` in all files with the actual repo name.
- Search for `REPLACE_ME` in all files to find areas that need manual input.
- On the settings page (https://github.com/snout-router/GITHUB_REPO_NAME/settings):
- Disable the "Wikis" feature
- Disable the "Projects" feature
- Enable "Automatically delete head branches" under the "Merge button" section
- In the "About" section of the repo:
- Set the repo description and URL
- Disable "Packages" and "Environments"

[badge-version-image]: https://img.shields.io/npm/v/@snout/eslint-config-react?label=%40snout%2Feslint-config-react&logo=npm&style=for-the-badge
[badge-version-link]: https://npmjs.com/package/@snout/eslint-config-react

## Installation

Install as an NPM and then resolve all the peer dependency issues. Peer
dependencies are necessary because of [an ESLint limitation].

## Usage

Designed for use in conjunction with [@snout-router/eslint-config].

```js
// .eslintrc.js
module.exports = {
extends: [
'@snout/react',
],
}
```

<!-- References -->

[@snout-router/eslint-config]: https://github.com/snout-router/eslint-config
[an eslint limitation]: https://github.com/eslint/eslint/issues/3458
1 change: 0 additions & 1 deletion jest.config.js

This file was deleted.

45 changes: 20 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
{
"name": "@snout/GITHUB_REPO_NAME",
"name": "@snout/eslint-config-react",
"version": "0.0.0",
"description": "REPLACE_ME",
"repository": "snout-router/GITHUB_REPO_NAME",
"bugs": "https://github.com/snout-router/GITHUB_REPO_NAME/issues",
"description": "The ESLint configuration used by Snout repositories that use React",
"keywords": [
"eslint",
"eslintconfig"
],
"repository": "snout-router/eslint-config-react",
"bugs": "https://github.com/snout-router/eslint-config-react/issues",
"homepage": "https://snout.dev",
"author": "Erin Millard <[email protected]>",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "dist/index.js",
"module": "dist/index.es.js",
"typings": "dist/index.d.ts",
"sideEffects": false,
"main": ".eslintrc.js",
"files": [
"/dist/"
".eslintrc.js"
],
"engines": {
"node": ">=14"
},
"scripts": {
"prepare": "rollup --config rollup.config.js"
"dependencies": {
"@snout/eslint-config": "^2.0.0",
"eslint-config-standard-jsx": "^10.0.0",
"eslint-config-standard-react": "^11.0.1"
},
"devDependencies": {
"@snout/eslint-config": "^1.1.2",
"@snout/jest-config": "^1.0.2",
"@snout/rollup-config": "^1.1.2",
"@snout/tsconfig": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"codecov": "^3.0.2",
"eslint": "^7.21.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.3.2",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"eslint": ">=7",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-jest": ">=24",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-react": "^7.24.0",
"react": "^17.0.2",
"typescript": "^4.2.3"
"typescript": "^4.3.5"
}
}
4 changes: 0 additions & 4 deletions rollup.config.js

This file was deleted.

1 change: 0 additions & 1 deletion src/index.ts

This file was deleted.

5 changes: 0 additions & 5 deletions test/unit/placeholder.spec.ts

This file was deleted.

3 changes: 0 additions & 3 deletions tsconfig.json

This file was deleted.

0 comments on commit bbf45aa

Please sign in to comment.