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

fix: Prettier and Linting for smoother onboarding #123

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
49 changes: 43 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
{
"extends": ["airbnb-base", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"extends": [
"./node_modules/gts/",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
"plugins": [
"@typescript-eslint",
"prettier",
"jest",
"eslint-plugin-node"
],
"rules": {
"prettier/prettier": ["error"],
"no-underscore-dangle": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"object-curly-spacing": ["error", "always"],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"semi-style": ["error", "last"],
"no-tabs": "off",
"@typescript-eslint/indent": ["error", 2],
"max-len": ["error", {
"code": 100
}],
"max-len": [
"error",
{
"code": 100
}
],
"arrow-body-style": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"mjs": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
]
},
"settings": {
"import/resolver": {
Expand All @@ -18,6 +55,6 @@
"env": {
"mocha": true,
"node": true,
"browser": true,
},
"browser": true
}
}
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/gts/"
}
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('gts/.prettierrc.json')
}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<p align="center">
<img src='https://i.ibb.co/DKrGhVQ/Frame-1-1.png' width="100%" alt='React Diff Viewer' />
</p>
Expand All @@ -7,6 +6,7 @@
[![Build Status](https://travis-ci.com/praneshr/react-diff-viewer.svg?branch=master)](https://travis-ci.com/praneshr/react-diff-viewer)
[![npm version](https://badge.fury.io/js/react-diff-viewer.svg)](https://badge.fury.io/js/react-diff-viewer)
[![GitHub license](https://img.shields.io/github/license/praneshr/react-diff-viewer.svg)](https://github.com/praneshr/react-diff-viewer/blob/master/LICENSE)
[![Code Style: Google](https://img.shields.io/badge/code%20style-google-blueviolet.svg)](https://github.com/google/gts)

A simple and beautiful text diff viewer component made with [Diff](https://github.com/kpdecker/jsdiff) and [React](https://reactjs.org).

Expand All @@ -27,7 +27,7 @@ npm i react-diff-viewer
## Usage

```javascript
import React, { PureComponent } from 'react';
import React, {PureComponent} from 'react';
import ReactDiffViewer from 'react-diff-viewer';

const oldCode = `
Expand Down Expand Up @@ -102,7 +102,7 @@ An example using [Prism JS](https://prismjs.com)
```

```javascript
import React, { PureComponent } from 'react';
import React, {PureComponent} from 'react';
import ReactDiffViewer from 'react-diff-viewer';

const oldCode = `
Expand All @@ -128,7 +128,7 @@ if(a === 10) {
class Diff extends PureComponent {
highlightSyntax = str => (
<pre
style={{ display: 'inline' }}
style={{display: 'inline'}}
dangerouslySetInnerHTML={{
__html: Prism.highlight(str, Prism.languages.javascript),
}}
Expand Down Expand Up @@ -165,8 +165,8 @@ enum DiffMethod {
```

```javascript
import React, { PureComponent } from 'react';
import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer';
import React, {PureComponent} from 'react';
import ReactDiffViewer, {DiffMethod} from 'react-diff-viewer';

const oldCode = `
{
Expand Down Expand Up @@ -289,7 +289,7 @@ To override any style, just pass the new style object to the `styles` prop. New
For keys other than `variables`, the value can either be an object or string interpolation.

```javascript
import React, { PureComponent } from 'react';
import React, {PureComponent} from 'react';
import ReactDiffViewer from 'react-diff-viewer';

const oldCode = `
Expand All @@ -315,7 +315,7 @@ if(a === 10) {
class Diff extends PureComponent {
highlightSyntax = str => (
<span
style={{ display: 'inline' }}
style={{display: 'inline'}}
dangerouslySetInnerHTML={{
__html: Prism.highlight(str, Prism.languages.javascript),
}}
Expand Down
Loading