Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

🚧 snoowrap v2.0 (work in progress) #338

Merged
merged 35 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
46ec580
Fixed endOfLine issue
iMrDJAi Jul 14, 2021
6573a75
🚧 Switching to axios!
iMrDJAi Jul 18, 2021
eb1bf8f
🚧 Switching to axios! Pt. 2
iMrDJAi Jul 20, 2021
21943b3
🩹 Minor fixes
iMrDJAi Jul 24, 2021
222ca46
Merge branch 'not-an-aardvark:master' into master
iMrDJAi Aug 2, 2021
ebd3ab1
🚧 snoowrap v2.0
iMrDJAi Aug 9, 2021
d018672
🚧 snoowrap v2.0 Pt. 2
iMrDJAi Aug 12, 2021
4193e70
🚧 Checkpoint...
iMrDJAi Aug 18, 2021
df9c6fd
🔨 Updated snoowrap.js
iMrDJAi Aug 19, 2021
b145df9
📝 Added docs for `src/objects/MediaFile.ts`
iMrDJAi Aug 26, 2021
2444e51
🚧 Check point
iMrDJAi Sep 26, 2021
a42b0a5
🩹 Quick fix
iMrDJAi Sep 26, 2021
9db5f78
🔨 Updates...
iMrDJAi Sep 28, 2021
48d1567
🔨 Updated Subreddit.js
iMrDJAi Sep 29, 2021
66a68c6
📝 Added a new badge to README.md
iMrDJAi Jan 7, 2022
a4fb2dc
fix typo in wikipages object declaration
jamesrswift Jan 23, 2022
87ed7a2
Fix setter returning a value
jamesrswift Jan 23, 2022
22480c1
Merge pull request #2 from JamesxX/fix-typings
iMrDJAi Jan 23, 2022
5602a96
Merge pull request #4 from JamesxX/helpers.js-update
iMrDJAi Jan 23, 2022
dc0e571
correct typings for voteablecontent
jamesrswift Jan 23, 2022
0562bb5
Merge pull request #5 from JamesxX/votablecontent-properties
iMrDJAi Jan 24, 2022
880b007
🔨 snoowrap 2.0.0: refactor (1)
iMrDJAi Feb 26, 2022
77fe90a
✅ Listing.ts (2)
iMrDJAi Mar 5, 2022
d52f57a
✅ More.ts (2)
iMrDJAi Mar 8, 2022
8901aa5
Hot fix (_fetchMoreComments method)
iMrDJAi Mar 14, 2022
03e66b3
✅ RedditContent.ts (2)
iMrDJAi Mar 16, 2022
6955cf4
Checkpoint
iMrDJAi Mar 30, 2022
8497102
Checkpoint 2
iMrDJAi Mar 31, 2022
7e7a4ae
Checkpoint
iMrDJAi Apr 5, 2022
62b5c6a
Checkpoint..
iMrDJAi Apr 10, 2022
fbe7534
get unit tests running, modhashes aren't really used anymore
jrunge Apr 11, 2022
6762a4f
Another checkpoint...
iMrDJAi Apr 11, 2022
5f74ddd
Revert "Hot fix (_fetchMoreComments method)"
iMrDJAi Apr 12, 2022
e52da05
Merge pull request #6 from jrunge/master
iMrDJAi Apr 12, 2022
79bce80
Merge pull request #8 from iMrDJAi/dev2
iMrDJAi Oct 28, 2022
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
26 changes: 18 additions & 8 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rules:
comma-spacing: error
comma-style: error
computed-property-spacing: error
curly: error
curly: [error, multi-line]
dot-notation: error
dot-location: [error, property]
eol-last: error
Expand All @@ -19,18 +19,18 @@ rules:
indent: [error, 2, {FunctionDeclaration: {body: 1, parameters: 1}, FunctionExpression: {body: 1, parameters: 1}, CallExpression: {arguments: 1}, SwitchCase: 1, MemberExpression: 1}]
Copy link

Choose a reason for hiding this comment

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

Suggested change
indent: [error, 2, {FunctionDeclaration: {body: 1, parameters: 1}, FunctionExpression: {body: 1, parameters: 1}, CallExpression: {arguments: 1}, SwitchCase: 1, MemberExpression: 1}]
"@typescript-eslint/indent": [error, 2, {FunctionDeclaration: {body: 1, parameters: 1}, FunctionExpression: {body: 1, parameters: 1}, CallExpression: {arguments: 1}, SwitchCase: 1, MemberExpression: 1}]

Copy link
Author

Choose a reason for hiding this comment

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

@DedaDev I believe we should disable all formatting rules and install prettier instead.

key-spacing: error
keyword-spacing: error
linebreak-style: [error, unix]
max-statements-per-line: error
new-parens: error
no-caller: error
no-catch-shadow: error
no-console: error
no-duplicate-imports: error
no-dupe-class-members: off
no-duplicate-imports: off
no-else-return: error
no-eval: error
no-extra-bind: error
no-extra-label: error
no-extra-parens: [error, all, {nestedBinaryExpressions: false}]
no-extra-parens: off
no-floating-decimal: error
no-global-assign: error
no-implied-eval: error
Expand All @@ -46,6 +46,7 @@ rules:
no-octal-escape: error
no-proto: error
no-prototype-builtins: error
no-redeclare: off
no-restricted-properties: [error, {object: describe, property: only}, {object: it, property: only}]
no-script-url: error
no-self-compare: error
Expand All @@ -54,10 +55,11 @@ rules:
no-tabs: error
no-template-curly-in-string: error
no-trailing-spaces: error
no-undef: off # TypeScript will handle this
no-unneeded-ternary: error
no-unsafe-negation: error
no-unused-expressions: error
no-unused-vars: error
no-unused-vars: off
no-useless-call: error
no-useless-computed-key: error
no-useless-concat: error
Expand All @@ -79,8 +81,8 @@ rules:
prefer-spread: error
quote-props: [error, as-needed]
quotes: [error, single, avoid-escape]
semi: [error, always]
semi-spacing: error
# semi: [error, never]
# semi-spacing: error
Copy link

Choose a reason for hiding this comment

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

why commented?

Copy link
Author

Choose a reason for hiding this comment

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

@DedaDev To temporarily suspense linter error till I remove all semicolons.

space-before-blocks: error
space-before-function-paren: error
space-in-parens: error
Expand All @@ -99,12 +101,19 @@ rules:
promise/catch-or-return: error
promise/no-return-wrap: error
promise/param-names: error
promise/no-native: error
'@typescript-eslint/consistent-type-imports': error
'@typescript-eslint/no-dupe-class-members': error
'@typescript-eslint/no-duplicate-imports': error
'@typescript-eslint/no-extra-parens': [error, all, {nestedBinaryExpressions: false}]
'@typescript-eslint/no-redeclare': error
'@typescript-eslint/no-unused-vars': error

extends:
- eslint:recommended
- plugin:import/errors
- plugin:import/warnings
- plugin:import/typescript

plugins:
- import
- promise
Expand All @@ -123,3 +132,4 @@ parserOptions:
env:
node: true
es6: true
browser: true
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ coverage/
test/_browser.spec.js
oauth_info.json
.eslintcache
browser/_index.js
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# snoowrap [![Build Status](https://travis-ci.org/not-an-aardvark/snoowrap.svg?branch=master)](https://travis-ci.org/not-an-aardvark/snoowrap) [![Gitter chat](https://badges.gitter.im/not-an-aardvark/snoowrap.svg)](https://gitter.im/not-an-aardvark/snoowrap 'Join the chat at https://gitter.im/not-an-aardvark/snoowrap')
# snoowrap [![Build Status](https://travis-ci.org/not-an-aardvark/snoowrap.svg?branch=master)](https://travis-ci.org/not-an-aardvark/snoowrap) [![Gitter chat](https://badges.gitter.im/not-an-aardvark/snoowrap.svg)](https://gitter.im/not-an-aardvark/snoowrap 'Join the chat at https://gitter.im/not-an-aardvark/snoowrap') [![Discord](https://img.shields.io/discord/722505412057759917?color=%235865F2&logo=discord&logoColor=white)](https://discord.gg/vVpM7VgmGN 'Join the unofficial Discord channel at https://discord.gg/vVpM7VgmGN')

A fully-featured JavaScript wrapper for the reddit API. ([Documentation](https://not-an-aardvark.github.io/snoowrap))

Expand Down
26 changes: 26 additions & 0 deletions browser/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>snoowrap</title>
</head>
<body>
<p><b>Use the Browser Console to Test and Debug snoowrap Manually!</b></p>
<ol>
<li>To access the snoowrap class: <b>window.snoowrap</b>.</li>
<li>To access a snoowrap instance authenticated with a refresh token: <b>window.r</b>.</li>
<li>To access a snoowrap instance authenticated with username/password: <b>window.r2</b>.</li>
</ol>
<p>
<b>Use This Button to Import Files From Your Device to the Browser:</b>
<button onclick="document.getElementById('file-input').click();">Import File</button>
<input id="file-input" type="file" name="name" style="display: none;" />
</p>
<ol>
<li>This is useful if you want to upload something with snoowrap.</li>
<li>All imported files can be found here: <b>window.files</b>.</li>
</ol>
<p><b>Enjoy! &lt;3</b></p>
<script type="module" src="./index.js"></script>
</body>
</html>
40 changes: 40 additions & 0 deletions browser/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable no-console */
import snoowrap from '../src/snoowrap'
import BaseRequester from '../src/BaseRequester'

window.BaseRequester = BaseRequester.default

fetch('../oauth_info.json').then(async response => {
const oauthInfo = await response.json()

window.r = new snoowrap({
user_agent: oauthInfo.user_agent,
client_id: oauthInfo.client_id,
client_secret: oauthInfo.client_secret,
refresh_token: oauthInfo.refresh_token,
config: {
debug: true,
warnings: true
}
})

window.r2 = new snoowrap({
user_agent: oauthInfo.user_agent,
client_id: oauthInfo.client_id,
client_secret: oauthInfo.client_secret,
username: oauthInfo.username,
password: oauthInfo.password,
config: {
debug: true,
warnings: true
}
})
}).catch(err => console.error(err))

window.files = {}

const fileinput = document.getElementById('file-input')
fileinput.onchange = () => {
const file = fileinput.files[0]
if (file) window.files[file.name] = file
}
2 changes: 2 additions & 0 deletions noop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** A fallback for builtin node modules on browser */
export default undefined
Loading