-
Notifications
You must be signed in to change notification settings - Fork 0
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
V3 #23
V3 #23
Changes from all commits
a9ce657
d0efedb
a06c358
33cfdad
c9e0534
122b0d1
07d909c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["@launchpadlab/babel-preset/react"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed in order to test the react plugins |
||
} |
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This aligns with |
||
}, | ||
"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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This plugin is kind of abandonware it seems. It relies on a deprecated method and pollutes the console with a bunch of messages about it. Since it's just a dev dependency, I really don't care about pinning it |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,13 @@ module.exports = { | |
'extends': [ | ||
'./es6.js', | ||
'plugin:react/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:jsx-a11y/recommended', | ||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's time There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, do you know if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's very unlikely 😅 . But that's the point! |
||
], | ||
'plugins': [ | ||
'react', | ||
'react-hooks', | ||
'jsx-a11y' | ||
], | ||
'rules': { | ||
'react/prop-types': [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
const execSync = require('child_process').execSync | ||
const { ESLint } = require('eslint') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks ChatGPT ;) |
||
|
||
// 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')) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { ESLint } = require('eslint') | ||
chawes13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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) | ||
}) |
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 |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without specifying the dist, Travis fails to locate GLIB_C (still, somehow 🙃)