-
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.
* Update dependencies * Add react hooks plugin * Add plugin to reference rules not included in recommended * Add jsx-a11y plugin and plugin tests * Bump major * Update node version * Specify distribution for Node 18
- Loading branch information
Showing
11 changed files
with
4,168 additions
and
3,383 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
language: node_js | ||
node_js: | ||
- '8' | ||
- '18' | ||
dist: focal | ||
notifications: | ||
email: false | ||
deploy: | ||
|
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 @@ | ||
{ | ||
"presets": ["@launchpadlab/babel-preset/react"] | ||
} |
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
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 |
---|---|---|
@@ -1,25 +1,32 @@ | ||
{ | ||
"name": "@launchpadlab/eslint-config", | ||
"version": "2.7.0", | ||
"version": "3.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"author": "dpikt", | ||
"engines": { | ||
"node": ">= 10" | ||
}, | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"babel-eslint": "^8.0.2", | ||
"eslint-import-resolver-webpack": "^0.8.3", | ||
"eslint-plugin-import": "^2.13.0", | ||
"eslint-plugin-react": "^7.10.0" | ||
"@babel/core": ">= 7.2.0", | ||
"@babel/eslint-parser": "^7.21.3", | ||
"eslint": "^8.0.0", | ||
"eslint-import-resolver-webpack": "^0.13.2", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jsx-a11y": "^6.7.1", | ||
"eslint-plugin-react": "^7.32.2", | ||
"eslint-plugin-react-hooks": "^4.6.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.0.0", | ||
"jest": "^21.2.1", | ||
"@launchpadlab/babel-preset": "^2.1.1", | ||
"jest": "^29.5.0", | ||
"react": "^16.8.6", | ||
"webpack": "^3.8.1" | ||
"webpack": "^5.0.0" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">= 3.0.0" | ||
"resolutions": { | ||
"babel-plugin-lodash/@babel/types": "~7.20.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
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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
const execSync = require('child_process').execSync | ||
const { ESLint } = require('eslint') | ||
|
||
// Basic sanity checks to make sure there are no syntax errors in the configs | ||
|
||
function runConfig (config) { | ||
execSync(`node_modules/.bin/eslint --config ${ config }.js test/test-input.js`, { stdio: 'inherit' }) | ||
async function runConfig (config) { | ||
const cli = new ESLint({ overrideConfigFile: `${config}.js`}) | ||
return cli.lintFiles(['test/test-input.js']) | ||
} | ||
|
||
test('index', () => runConfig('index')) | ||
test('base', () => runConfig('base')) | ||
test('es6', () => runConfig('es6')) | ||
test('react', () => runConfig('react')) | ||
test('react-rails', () => runConfig('react-rails')) | ||
test('index', async () => runConfig('index')) | ||
test('base', async () => runConfig('base')) | ||
test('es6', async () => runConfig('es6')) | ||
test('react', async () => runConfig('react')) | ||
test('react-rails', async () => runConfig('react-rails')) |
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,16 @@ | ||
const { ESLint } = require('eslint') | ||
|
||
test('JSX A11y', async () => { | ||
const cli = new ESLint({ overrideConfigFile: 'react.js' }) | ||
const results = await cli.lintFiles(['test/plugins/jsx-a11y.js']) | ||
const issueCount = results.reduce((acc, result) => acc + result.errorCount + result.warningCount, 0) | ||
|
||
expect(issueCount).toBeGreaterThan(0) | ||
}) | ||
|
||
test('React Hooks', async () => { | ||
const cli = new ESLint({ overrideConfigFile: 'react.js' }) | ||
const results = await cli.lintFiles(['test/plugins/react-hooks.js']) | ||
const issueCount = results.reduce((acc, result) => acc + result.errorCount + result.warningCount, 0) | ||
expect(issueCount).toBeGreaterThan(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,9 @@ | ||
import React from 'react' | ||
|
||
function JsxA11y() { | ||
return ( | ||
<div onClick={() => null}>Click Me</div> | ||
) | ||
} | ||
|
||
export default JsxA11y |
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,19 @@ | ||
import React, { useState, useEffect } from 'react' | ||
|
||
function ReactHooks() { | ||
const [count, setCount] = useState(0) | ||
|
||
if (count) { | ||
useEffect(() => { | ||
if (count > 20) { | ||
setCount(0) | ||
} | ||
}, []) | ||
} | ||
|
||
return ( | ||
<button onClick={() => setCount((c) => c+1)}>Count: {count}</button> | ||
) | ||
} | ||
|
||
export default ReactHooks |
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
Oops, something went wrong.