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

Please the linter gods #117

Merged
merged 1 commit into from
Jan 24, 2020
Merged
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
legacy
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "vtex",
"env": {
"node": true
}
}
7 changes: 1 addition & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"eslintIntegration": true
}
"@vtex/prettier-config"
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Sort numbers by value instead of alphabetically.

## [2.25.0] - 2020-01-06
### Changed
Expand Down Expand Up @@ -83,7 +85,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added CSS Override class to header row background.

### Added
- Allow `drawer` block on `header-row`.
- Allow `drawer` block on `header-row`.

## [2.16.0] - 2019-04-24
### Changed
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ You can check if others are passing through similar issues [here](https://github

## Contributing

Check it out [how to contribute](https://github.com/vtex-apps/awesome-io#contributing) with this project.
Check it out [how to contribute](https://github.com/vtex-apps/awesome-io#contributing) with this project.

## Tests

Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"private": true,
"devDependencies": {
"eslint": "^5.16.0",
"eslint-config-vtex-react": "^4.0.0",
"prettier": "^1.16.4",
"typescript": "^3.4.1"
"scripts": {
"lint": "eslint --ext js,jsx,ts,tsx .",
"format": "prettier --write \"**/*.{ts,js,json}\""
},
"dependencies": {
"@vtex/css-handles": "^1.1.0"
"devDependencies": {
"@vtex/prettier-config": "^0.0.1",
"eslint": "^6.8.0",
"eslint-config-vtex-react": "^5.1.0",
"prettier": "^1.19.1",
"react": "^16.12.0",
"typescript": "^3.7.5"
}
}
4 changes: 1 addition & 3 deletions react/ForceCenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ const ForceCenter = ({ children }) => {

return (
<div
className={`${
handles.forceCenter
} absolute left-0 right-0 flex justify-center z-1`}
className={`${handles.forceCenter} absolute left-0 right-0 flex justify-center z-1`}
style={{ pointerEvents: 'none' }}
>
<div
Expand Down
1 change: 1 addition & 0 deletions react/__tests__/Header.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import { render } from '@vtex/test-tools/react'
import { useRuntime } from 'vtex.render-runtime'

import Header from '../legacy/index'

describe('Header Component', () => {
Expand Down
1 change: 1 addition & 0 deletions react/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { FunctionComponent } from 'react'

import StickyRows from './StickyRows'

const Layout: FunctionComponent = ({ children }) => {
Expand Down
2 changes: 2 additions & 0 deletions react/components/StickyRows.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { FunctionComponent } from 'react'

import useCumulativeHeightState from '../hooks/useCumulativeHeightState'

const RowContext = React.createContext<{
onResize(height: number): void
offset: number
}>({
// eslint-disable-next-line @typescript-eslint/no-empty-function
onResize: () => {},
offset: 0,
})
Expand Down
2 changes: 1 addition & 1 deletion react/hooks/useCumulativeHeightState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const useCumulativeHeightState = () => {
const getAccumulatedHeight = (index: number) => {
const sortedIndices = Object.keys(state)
.map(key => parseInt(key, 10))
.sort()
.sort((a, b) => a - b)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably no one will have 9+ sticky rows, but if they do, this would sort it alphabetically 1, 10, 2, 3, 4....


const indices = sortedIndices.slice(0, sortedIndices.indexOf(index))

Expand Down
1 change: 1 addition & 0 deletions react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Suspense } from 'react'
import { useChildBlock, NoSSR } from 'vtex.render-runtime'

import CustomHeader from './components/CustomHeader'

const LegacyHeader = React.lazy(() => import('./legacy'))

const Header = props => {
Expand Down
16 changes: 8 additions & 8 deletions react/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"version": "2.25.0",
"name": "vtex.header",
"description": "A Header Component.",
"license": "ISC",
Expand All @@ -9,6 +10,12 @@
"gen:coveralls": "yarn test:coverage && cat ./coverage/lcov.info | coveralls",
"lint": "tsc --noEmit && eslint --ext ts,tsx ."
},
"devDependencies": {
"@types/classnames": "^2.2.7",
"@vtex/test-tools": "^0.1.3",
"apollo-client": "^2.5.1",
"coveralls": "^3.0.3"
},
"dependencies": {
"@types/react-resize-detector": "^3.1.1",
"@vtex/css-handles": "^1.1.3",
Expand All @@ -26,12 +33,5 @@
},
"vtexScriptsOverride": {
"srcPath": "."
},
"devDependencies": {
"@types/classnames": "^2.2.7",
"@vtex/test-tools": "^0.1.3",
"apollo-client": "^2.5.1",
"coveralls": "^3.0.3"
},
"version": "2.25.0"
}
}
1 change: 1 addition & 0 deletions react/testUtils/test-utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import * as reactTestingLibrary from 'react-testing-library'
import { IntlProvider } from 'react-intl'

import defaultStrings from '../../messages/en.json'

const customRender = (node, options) => {
Expand Down
5 changes: 1 addition & 4 deletions react/typings/css.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
declare module '*.css' {
const css: any
export default css
}
declare module '*.css'
Loading