Skip to content
Open

Next #18

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
21 changes: 18 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
module.exports = {
plugins: ['eslint-plugin-jsdoc'],
env: {
commonjs: true,
es2021: true,
node: true
},
plugins: ['prettier', 'jsdoc'],
extends: [
'standard',
// resolve conflicts between prettier and eslint
'plugin:prettier/recommended',
// from eslint-plugin-jsdoc
// @see https://github.com/gajus/eslint-plugin-jsdoc#configuration
// warnings not work with prettier-standard therefore this ruleset not effective
'plugin:jsdoc/recommended'
]
],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 12
},
rules: {
'prefer-regex-literals': ['off'],
'jsdoc/no-undefined-types': ['off']
}
}
Empty file modified .husky/commit-msg
100644 → 100755
Empty file.
Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
bracketSpacing: true,
singleQuote: true,
trailingComma: 'none',
arrowParens: 'avoid',
semi: false,
};
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [Development](#development)
- [Commit Messages](#commit-messages)
- [Code Quality](#code-quality)
- [Testing](#testing)
- [Available Scripts](#available-scripts)
- [Special Thanks](#special-thanks)
- [License](#license)
Expand Down Expand Up @@ -80,23 +81,26 @@ Keeping code quality as good is a hard job in normally. Therefore, we are using

In short, run `npm run lint` command.

## Testing

Writing tests is boring but also necessary. If you want to write a test look at other tests and don't forget apply proxy over Travis because of ridvanaltun/eksi-sozluk#16. The proxy server running over my local environment therefore sometimes it is not reacable, test fails on Travis when my local environment is turned off or the proxy server is turned off.

I accept PRs by myself anyway so running tests over Travis is not a problem for a contributor. You can run tests on your local anytime.

## Available Scripts

```bash
# commit your changes with commitizen
npm run commit

# check linter and prettier errors, fix prettier errors in default
# check eslint issues
npm run lint

# check the linter and prettier errors
npm run lint:check

# run prettier
npm run format
# fix eslint issues
npm run lint:fix

# check prettier errors
npm run format:check
# run eslint-nibble
npm run lint:active

# run all tests
npm run test
Expand Down
12 changes: 11 additions & 1 deletion __tests__/agenda.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const { EksiSozluk } = require('../src/index')
const HttpsProxyAgent = require('https-proxy-agent')

const instance = new EksiSozluk()
let httpClient = {};

// use proxy over Travis
if (process.env.TRAVIS) {
httpClient = {
httpsAgent: new HttpsProxyAgent(process.env.PROXY)
}
}

const instance = new EksiSozluk({httpClient})

describe('Agenda Test', () => {
test('Getting Agenda', () => {
Expand Down
12 changes: 11 additions & 1 deletion __tests__/debe.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const { EksiSozluk } = require('../src/index')
const HttpsProxyAgent = require('https-proxy-agent')

const instance = new EksiSozluk()
let httpClient = {};

// use proxy over Travis
if (process.env.TRAVIS) {
httpClient = {
httpsAgent: new HttpsProxyAgent(process.env.PROXY)
}
}

const instance = new EksiSozluk({httpClient})

describe('Debe Test', () => {
test('Getting Debe', () => {
Expand Down
12 changes: 11 additions & 1 deletion __tests__/entries.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const { EksiSozluk } = require('../src/index')
const HttpsProxyAgent = require('https-proxy-agent')

const instance = new EksiSozluk()
let httpClient = {};

// use proxy over Travis
if (process.env.TRAVIS) {
httpClient = {
httpsAgent: new HttpsProxyAgent(process.env.PROXY)
}
}

const instance = new EksiSozluk({httpClient})

describe('Entries Test', () => {
test('Getting Entries', () => {
Expand Down
12 changes: 11 additions & 1 deletion __tests__/entry.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const { EksiSozluk } = require('../src/index')
const HttpsProxyAgent = require('https-proxy-agent')

const instance = new EksiSozluk()
let httpClient = {};

// use proxy over Travis
if (process.env.TRAVIS) {
httpClient = {
httpsAgent: new HttpsProxyAgent(process.env.PROXY)
}
}

const instance = new EksiSozluk({httpClient})

describe('Entry Test', () => {
test('Getting Entry By Id', () => {
Expand Down
12 changes: 11 additions & 1 deletion __tests__/questions.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const { EksiSozluk } = require('../src/index')
const HttpsProxyAgent = require('https-proxy-agent')

const instance = new EksiSozluk()
let httpClient = {};

// use proxy over Travis
if (process.env.TRAVIS) {
httpClient = {
httpsAgent: new HttpsProxyAgent(process.env.PROXY)
}
}

const instance = new EksiSozluk({httpClient})

describe('Questions Test', () => {
test('Getting Questions in Agenda', () => {
Expand Down
12 changes: 11 additions & 1 deletion __tests__/tags.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const { EksiSozluk } = require('../src/index')
const HttpsProxyAgent = require('https-proxy-agent')

const instance = new EksiSozluk()
let httpClient = {};

// use proxy over Travis
if (process.env.TRAVIS) {
httpClient = {
httpsAgent: new HttpsProxyAgent(process.env.PROXY)
}
}

const instance = new EksiSozluk({httpClient})

describe('Tags Test', () => {
test('Getting Tags', () => {
Expand Down
12 changes: 11 additions & 1 deletion __tests__/todayInHistory.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const { EksiSozluk } = require('../src/index')
const HttpsProxyAgent = require('https-proxy-agent')

const instance = new EksiSozluk()
let httpClient = {};

// use proxy over Travis
if (process.env.TRAVIS) {
httpClient = {
httpsAgent: new HttpsProxyAgent(process.env.PROXY)
}
}

const instance = new EksiSozluk({httpClient})

describe('Today in History Test', () => {
test('Getting Today in History', () => {
Expand Down
12 changes: 11 additions & 1 deletion __tests__/user.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const { EksiSozluk } = require('../src/index')
const HttpsProxyAgent = require('https-proxy-agent')

const instance = new EksiSozluk()
let httpClient = {};

// use proxy over Travis
if (process.env.TRAVIS) {
httpClient = {
httpsAgent: new HttpsProxyAgent(process.env.PROXY)
}
}

const instance = new EksiSozluk({httpClient})

describe('User Test', () => {
test('Getting User', () => {
Expand Down
13 changes: 11 additions & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
"body-max-line-length": [1, "always", 100],
}
'body-max-line-length': [1, 'always', 100]
},
helpUrl: `
Commit messages must follow conventional commit format:
https://www.conventionalcommits.org/en/v1.0.0/#summary
type(optional-scope): subject

[optional body]
* To bypass pre-commit hooks run 'git commit --no-verify'
>>> Use "yarn commit" for interactive prompt. <<<
`
}
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ module.exports = {
roots: ['__tests__/'],
// This line solves: Cross origin http://localhost forbidden
// @see https://github.com/axios/axios/issues/1754
testEnvironment: 'node'
testEnvironment: 'node',
testTimeout: 10000 // default 5 secs, we are using 10 secs
}
Loading