diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..4b0accb --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,39 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": "eslint:recommended", + "overrides": [ + ], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + 2 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ], + "eqeqeq": [ + "error", + "always" + ], + "curly": [ + "error", + "all" + ] + } +} diff --git a/package.json b/package.json index 4db4fa5..bcd26f4 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,22 @@ { "name": "@clvarley/simple-scroll", - "version": "1.0.0", + "version": "1.0.1", "description": "Simple utility to make scrolling elements into view easier.", "type": "module", - "keywords": ["scroll", "window", "browser", "DOM"], + "keywords": [ + "scroll", + "window", + "browser", + "DOM" + ], + "scripts": { + "lint": "eslint ./src" + }, "homepage": "https://github.com/clvarley/simple-scroll#readme", "main": "src/index.js", "author": "clvarley", - "license": "MIT" + "license": "MIT", + "devDependencies": { + "eslint": "^8.30.0" + } } diff --git a/src/index.js b/src/index.js index 2cabe33..d77ad1a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,10 @@ -import { simpleScroll } from './scroll'; +import { simpleScroll } from "./scroll"; import { TIMING_LINEAR, TIMING_EASE_IN, TIMING_EASE_OUT, TIMING_EASE_IN_OUT -} from './timing'; +} from "./timing"; simpleScroll.TIMING_LINEAR = TIMING_LINEAR; simpleScroll.TIMING_EASE_IN = TIMING_EASE_IN; diff --git a/src/scroll.js b/src/scroll.js index a2e26b4..0e96720 100644 --- a/src/scroll.js +++ b/src/scroll.js @@ -1,5 +1,5 @@ -import { getDocumentYOffset } from './position'; -import { TIMING_EASE_IN_OUT } from './timing'; +import { getDocumentYOffset } from "./position"; +import { TIMING_EASE_IN_OUT } from "./timing"; /** * Wrapper to provide `scrollTo` fallback for older browsers @@ -67,7 +67,7 @@ const simpleScroll = (target, options) => { const target_y = getDocumentYOffset(target) - padding; if (!duration) { - tryScroll({ top: target_y, left: 0, behavior: 'smooth' }); + tryScroll({ top: target_y, left: 0, behavior: "smooth" }); } else { animateScroll(target_y, duration, timing); }