Skip to content

Commit

Permalink
refactor: code
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Sep 21, 2020
2 parents 797d678 + cd34138 commit d436934
Show file tree
Hide file tree
Showing 15 changed files with 3,696 additions and 1,933 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
11 changes: 11 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parserOptions": {
"ecmaVersion": 2018
},
"env": {
"es6": true,
"node": true,
"jest": true
},
"extends": "eslint:recommended"
}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.idea
*.iml
.nyc_output
coverage
lib
node_modules
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
language: node_js

node_js:
- "6"
- "node"
- "10"
- "12"
- "14"

script: yarn ci

after_success:
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose
Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ into:

- Only a certain whitelist of properties are inspected. Currently, that whitelist is `['composes']` alone.
- An extend-import has the following format:

```
composes: className [... className] from "path/to/file.css";
```
Expand All @@ -37,14 +38,14 @@ composes: className [... className] from "path/to/file.css";

```css
.aa {
composes: b from './b.css';
composes: c from './c.css';
composes: b from "./b.css";
composes: c from "./c.css";
}

.bb {
/* "b.css" should be before "c.css" in this case */
composes: c from './c.css';
composes: b from './b.css';
composes: c from "./c.css";
composes: b from "./b.css";
}
```

Expand All @@ -57,13 +58,8 @@ npm test

[![Build Status](https://travis-ci.org/css-modules/postcss-modules-extract-imports.svg?branch=master)](https://travis-ci.org/css-modules/postcss-modules-extract-imports)

* Lines: [![Coverage Status](https://coveralls.io/repos/css-modules/postcss-modules-extract-imports/badge.svg?branch=master)](https://coveralls.io/r/css-modules/postcss-modules-extract-imports?branch=master)
* Statements: [![codecov.io](http://codecov.io/github/css-modules/postcss-modules-extract-imports/coverage.svg?branch=master)](http://codecov.io/github/css-modules/postcss-modules-extract-imports?branch=master)

## Development

- `npm watch` will watch `src` for changes and rebuild
- `npm autotest` will watch `src` and `test` for changes and retest
- Lines: [![Coverage Status](https://coveralls.io/repos/css-modules/postcss-modules-extract-imports/badge.svg?branch=master)](https://coveralls.io/r/css-modules/postcss-modules-extract-imports?branch=master)
- Statements: [![codecov.io](http://codecov.io/github/css-modules/postcss-modules-extract-imports/coverage.svg?branch=master)](http://codecov.io/github/css-modules/postcss-modules-extract-imports?branch=master)

## License

Expand All @@ -76,4 +72,5 @@ ISC
- Guy Bedford

---

Glen Maddern, 2015.
5 changes: 5 additions & 0 deletions husky.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
hooks: {
"pre-commit": "lint-staged",
},
};
4 changes: 4 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
"*.js": ["prettier --write", "eslint --fix"],
"*.{json,md,yml,css,ts}": ["prettier --write"],
};
38 changes: 20 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
"description": "A CSS Modules transform to extract local aliases for inline imports",
"main": "src/index.js",
"engines": {
"node": ">= 6"
"node": ">= 10.13.0 || >= 12.13.0 || >= 14"
},
"files": [
"src"
],
"scripts": {
"prettier": "prettier -l --ignore-path .gitignore . \"!test/test-cases\"",
"eslint": "eslint --ignore-path .gitignore .",
"lint": "yarn eslint && yarn prettier",
"pretest": "yarn lint",
"test": "jest --coverage",
"precommit": "lint-staged",
"prepublish": "yarn run test"
},
"lint-staged": {
"*.js": [
"prettier --single-quote --no-semi --write",
"git add"
]
"autotest": "jest --coverage --watch",
"cover": "jest --coverage",
"ci": "yarn pretest && yarn cover",
"prepublishOnly": "yarn test"
},
"repository": {
"type": "git",
Expand All @@ -35,15 +35,17 @@
"url": "https://github.com/css-modules/postcss-modules-extract-imports/issues"
},
"homepage": "https://github.com/css-modules/postcss-modules-extract-imports",
"dependencies": {
"postcss": "^7.0.5"
},
"devDependencies": {
"codecov.io": "^0.1.2",
"coveralls": "^2.11.2",
"husky": "^0.13.3",
"jest": "^20.0.3",
"lint-staged": "^3.4.2",
"prettier": "^1.3.1"
"codecov.io": "^0.1.6",
"coveralls": "^3.1.0",
"eslint": "^7.9.0",
"husky": "^4.3.0",
"jest": "^26.4.2",
"lint-staged": "^10.4.0",
"postcss": "^8.0.6",
"prettier": "^2.1.2"
},
"peerDependencies": {
"postcss": "^8.0.6"
}
}
Loading

0 comments on commit d436934

Please sign in to comment.