forked from antfu/eslint-config
-
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.
- Loading branch information
Showing
89 changed files
with
6,734 additions
and
3,954 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Release | |
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
- "v*" | ||
|
||
jobs: | ||
release: | ||
|
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
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,73 +1,71 @@ | ||
// This file is generated by ChatGPT | ||
|
||
// eslint-disable-next-line no-console | ||
const log = console.log | ||
const log = console.log; | ||
|
||
// Define a class using ES6 class syntax | ||
class Person { | ||
constructor(name, age) { | ||
this.name = name | ||
this.age = age | ||
this.name = name; | ||
this.age = age; | ||
} | ||
|
||
// Define a method within the class | ||
sayHello() { | ||
log(`Hello, my name is ${this.name} and I am ${this.age} years old.`) | ||
log(`Hello, my name is ${this.name} and I am ${this.age} years old.`); | ||
} | ||
} | ||
|
||
// Create an array of objects | ||
const people = [ | ||
new Person('Alice', 30), | ||
new Person('Bob', 25), | ||
new Person('Charlie', 35), | ||
] | ||
new Person("Alice", 30), | ||
new Person("Bob", 25), | ||
new Person("Charlie", 35), | ||
]; | ||
|
||
// Use the forEach method to iterate over the array | ||
people.forEach((person) => { | ||
person.sayHello() | ||
}) | ||
person.sayHello(); | ||
}); | ||
|
||
// Use a template literal to create a multiline string | ||
const multilineString = ` | ||
This is a multiline string | ||
that spans multiple lines. | ||
` | ||
`; | ||
|
||
// Use destructuring assignment to extract values from an object | ||
const { name, age } = people[0] | ||
log(`First person in the array is ${name} and they are ${age} years old.`, multilineString) | ||
const { name, age } = people[0]; | ||
log( | ||
`First person in the array is ${name} and they are ${age} years old.`, | ||
multilineString | ||
); | ||
|
||
// Use the spread operator to create a new array | ||
const numbers = [1, 2, 3] | ||
const newNumbers = [...numbers, 4, 5] | ||
log(newNumbers) | ||
const numbers = [1, 2, 3]; | ||
const newNumbers = [...numbers, 4, 5]; | ||
log(newNumbers); | ||
|
||
// Use a try-catch block for error handling | ||
try { | ||
// Attempt to parse an invalid JSON string | ||
JSON.parse('invalid JSON') | ||
} | ||
catch (error) { | ||
console.error('Error parsing JSON:', error.message) | ||
JSON.parse("invalid JSON"); | ||
} catch (error) { | ||
console.error("Error parsing JSON:", error.message); | ||
} | ||
|
||
// Use a ternary conditional operator | ||
const isEven = num => num % 2 === 0 | ||
const number = 7 | ||
log(`${number} is ${isEven(number) ? 'even' : 'odd'}.`) | ||
const isEven = (num) => num % 2 === 0; | ||
const number = 7; | ||
log(`${number} is ${isEven(number) ? "even" : "odd"}.`); | ||
|
||
// Use a callback function with setTimeout for asynchronous code | ||
setTimeout(() => { | ||
log('This code runs after a delay of 2 seconds.') | ||
}, 2000) | ||
log("This code runs after a delay of 2 seconds."); | ||
}, 2000); | ||
|
||
let a, b, c, d, foo | ||
let a, b, c, d, foo; | ||
|
||
if (a | ||
|| b | ||
|| c || d | ||
|| (d && b) | ||
) { | ||
foo() | ||
if (a || b || c || d || (d && b)) { | ||
foo(); | ||
} |
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,27 +1,34 @@ | ||
export function HelloWorld({ | ||
greeting = 'hello', | ||
greeting = "hello", | ||
greeted = '"World"', | ||
silent = false, | ||
onMouseOver, | ||
}) { | ||
if (!greeting) { | ||
return null | ||
}; | ||
return null; | ||
} | ||
|
||
// TODO: Don't use random in render | ||
const num = Math.floor (Math.random() * 1e+7).toString() | ||
.replace(/\.\d+/g, '') | ||
const num = Math.floor(Math.random() * 1e7) | ||
.toString() | ||
.replace(/\.\d+/g, ""); | ||
|
||
return ( | ||
<div className="HelloWorld" title={`You are visitor number ${num}`} onMouseOver={onMouseOver}> | ||
<strong>{ greeting.slice(0, 1).toUpperCase() + greeting.slice(1).toLowerCase() }</strong> | ||
{greeting.endsWith(',') | ||
? ' ' | ||
: <span style={{ color: '\grey' }}>", "</span> } | ||
<em> | ||
{ greeted } | ||
</em> | ||
{ (silent) ? '.' : '!'} | ||
<div | ||
className="HelloWorld" | ||
title={`You are visitor number ${num}`} | ||
onMouseOver={onMouseOver} | ||
> | ||
<strong> | ||
{greeting.slice(0, 1).toUpperCase() + greeting.slice(1).toLowerCase()} | ||
</strong> | ||
{greeting.endsWith(",") ? ( | ||
" " | ||
) : ( | ||
<span style={{ color: "grey" }}>", "</span> | ||
)} | ||
<em>{greeted}</em> | ||
{silent ? "." : "!"} | ||
</div> | ||
) | ||
); | ||
} |
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,34 +1,35 @@ | ||
Header | ||
====== | ||
# Header | ||
|
||
_Look,_ code blocks are formatted *too!* | ||
_Look,_ code blocks are formatted _too!_ | ||
|
||
```js | ||
// This should be handled by ESLint instead of Prettier | ||
function identity(x) { | ||
if (foo) { | ||
console.log('bar') | ||
console.log("bar"); | ||
} | ||
} | ||
``` | ||
|
||
```css | ||
/* This should be handled by Prettier */ | ||
.foo { color:red;} | ||
.foo { | ||
color: red; | ||
} | ||
``` | ||
|
||
Pilot|Airport|Hours | ||
--|:--:|--: | ||
John Doe|SKG|1338 | ||
Jane Roe|JFK|314 | ||
| Pilot | Airport | Hours | | ||
| -------- | :-----: | ----: | | ||
| John Doe | SKG | 1338 | | ||
| Jane Roe | JFK | 314 | | ||
|
||
- - - - - - - - - - - - - - - | ||
--- | ||
|
||
+ List | ||
+ with a [link] (/to/somewhere) | ||
+ and [another one] | ||
- List | ||
- with a [link] (/to/somewhere) | ||
- and [another one] | ||
|
||
[another one]: http://example.com 'Example title' | ||
[another one]: http://example.com "Example title" | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
Curabitur consectetur maximus risus, sed maximus tellus tincidunt et. |
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.