Skip to content

Refactor code #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 16, 2020
Merged
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
5 changes: 2 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"ecmaVersion": 2018
},
"env": {
"es6": true,
"node": true
},
"rules": {
"quotes": [2, "single", { "avoidEscape": true }]
}
"extends": "eslint:recommended"
}
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
npm-debug.log
.idea
*.iml
.nyc_output
coverage
node_modules

6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: node_js

node_js:
- "6"
- "8"
- "10"
- "12"
- "14"
script: npm run travis

script: yarn ci

after_success:
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose
Expand Down
78 changes: 64 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,168 @@
# Change Log

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [3.0.3] - 2020-07-25

### Fixed

- treat `:import` and `:export` statements as pure

## [3.0.2] - 2019-06-05

### Fixed

- better handle invalid syntax

## [3.0.1] - 2019-05-16

### Fixed

- adds safety check before accessing "rule parent"

## [3.0.0] - 2019-05-07

### Features
- don't localize imported values in selectors

- don't localize imported values in selectors

### Changes
- don't localize imported values in selectors

- don't localize imported values in selectors

## [2.0.6] - 2019-03-05

### Fixed

- handles properly selector with escaping characters (like: `.\31 a2b3c { color: red }`)

## [2.0.5] - 2019-02-06

### Fixed

- Path to `index.js`

## [2.0.4] - 2019-01-04

### Fixed

- Inappropriate modification of `steps` function arguments

## [2.0.3] - 2018-12-21

### Fixed

- Don't modify inappropriate animation keywords

## [2.0.2] - 2018-12-05

### Fixed

- Don't break unicode characters.

## [2.0.1] - 2018-11-23

### Fixed

- Handle uppercase `keyframes` at rule.

## [2.0.0] - 2018-11-23

### Changed

- Drop support `nodejs@4`.
- Update `postcss` version to `7`.

## [0.0.11] - 2015-07-19

### Fixed

- Localisation of animation properties.

## [0.0.10] - 2015-06-17

### Added

- Localised at-rules.

## [0.0.9] - 2015-06-12

### Changed

- Using global selectors outside of a global context no longer triggers warnings. Instead, this functionality will be provided by a CSS Modules linter.

### Fixed

- Keyframe rules.

## [0.0.8] - 2015-06-11

### Added

- Pure mode where only local scope is allowed.

### Changed

- Using global selectors outside of a global context now triggers warnings.

## [0.0.7] - 2015-05-30

### Changed

- Migrated to `css-selector-tokenizer`.

## [0.0.6] - 2015-05-28

### Changed

- Renamed project to `postcss-modules-local-by-default`.

## [0.0.5] - 2015-05-22

### Added

- Support for css-loader [inheritance](https://github.com/webpack/css-loader#inheriting) and [local imports](https://github.com/webpack/css-loader#importing-local-class-names).

## [0.0.4] - 2015-05-22

### Changed

- Hide global leak detection behind undocumented `lint` option until it's more robust.

## [0.0.3] - 2015-05-22

### Changed

- Transformer output now uses the new `:local(.identifier)` syntax.

### Added

- Simple global leak detection. Non-local selectors like `input{}` and `[data-foobar]` now throw when not marked as global.

## [0.0.2] - 2015-05-14

### Added

- Support for global selectors appended directly to locals, e.g. `.foo:global(.bar)`

## 0.0.1 - 2015-05-12

### Added

- Automatic local classes
- Explicit global selectors with `:global`

[unreleased]: https://github.com/postcss-modules-local-by-default/compare/v0.0.10...HEAD
[0.0.2]: https://github.com/postcss-modules-local-by-default/compare/v0.0.1...v0.0.2
[0.0.3]: https://github.com/postcss-modules-local-by-default/compare/v0.0.2...v0.0.3
[0.0.4]: https://github.com/postcss-modules-local-by-default/compare/v0.0.3...v0.0.4
[0.0.5]: https://github.com/postcss-modules-local-by-default/compare/v0.0.4...v0.0.5
[0.0.6]: https://github.com/postcss-modules-local-by-default/compare/v0.0.5...v0.0.6
[0.0.7]: https://github.com/postcss-modules-local-by-default/compare/v0.0.6...v0.0.7
[0.0.8]: https://github.com/postcss-modules-local-by-default/compare/v0.0.7...v0.0.8
[0.0.9]: https://github.com/postcss-modules-local-by-default/compare/v0.0.8...v0.0.9
[0.0.10]: https://github.com/postcss-modules-local-by-default/compare/v0.0.9...v0.0.10
[0.0.11]: https://github.com/postcss-modules-local-by-default/compare/v0.0.10...v0.0.11
[2.0.0]: https://github.com/postcss-modules-local-by-default/compare/v1.3.1...v2.0.0
[2.0.1]: https://github.com/postcss-modules-local-by-default/compare/v2.0.0...v2.0.1
[0.0.2]: https://github.com/postcss-modules-local-by-default/compare/v0.0.1...v0.0.2
[0.0.3]: https://github.com/postcss-modules-local-by-default/compare/v0.0.2...v0.0.3
[0.0.4]: https://github.com/postcss-modules-local-by-default/compare/v0.0.3...v0.0.4
[0.0.5]: https://github.com/postcss-modules-local-by-default/compare/v0.0.4...v0.0.5
[0.0.6]: https://github.com/postcss-modules-local-by-default/compare/v0.0.5...v0.0.6
[0.0.7]: https://github.com/postcss-modules-local-by-default/compare/v0.0.6...v0.0.7
[0.0.8]: https://github.com/postcss-modules-local-by-default/compare/v0.0.7...v0.0.8
[0.0.9]: https://github.com/postcss-modules-local-by-default/compare/v0.0.8...v0.0.9
[0.0.10]: https://github.com/postcss-modules-local-by-default/compare/v0.0.9...v0.0.10
[0.0.11]: https://github.com/postcss-modules-local-by-default/compare/v0.0.10...v0.0.11
[2.0.0]: https://github.com/postcss-modules-local-by-default/compare/v1.3.1...v2.0.0
[2.0.1]: https://github.com/postcss-modules-local-by-default/compare/v2.0.0...v2.0.1
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Transformation examples:

<!-- prettier-ignore-start -->
```css
.foo { ... } /* => */ :local(.foo) { ... }

Expand All @@ -25,6 +26,7 @@ Transformation examples:

.foo:global(.bar) .baz { ... } /* => */ :local(.foo).bar :local(.baz) { ... }
```
<!-- prettier-ignore-end -->

## Building

Expand All @@ -33,9 +35,9 @@ $ npm install
$ npm test
```

- Build: [![Build Status][ci-img]][ci]
- Lines: [![coveralls][coveralls-img]][coveralls]
- Statements: [![codecov][codecov-img]][codecov]
- Build: [![Build Status][ci-img]][ci]
- Lines: [![coveralls][coveralls-img]][coveralls]
- Statements: [![codecov][codecov-img]][codecov]

## Development

Expand All @@ -49,17 +51,18 @@ MIT

## With thanks

- [Tobias Koppers](https://github.com/sokra)
- [Glen Maddern](https://github.com/geelen)
- [Tobias Koppers](https://github.com/sokra)
- [Glen Maddern](https://github.com/geelen)

---

Mark Dalgleish, 2015.

[ci-img]: https://img.shields.io/travis/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
[ci]: https://travis-ci.org/css-modules/postcss-modules-local-by-default
[npm-img]: https://img.shields.io/npm/v/postcss-modules-local-by-default.svg?style=flat-square
[npm]: https://www.npmjs.com/package/postcss-modules-local-by-default
[ci-img]: https://img.shields.io/travis/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
[ci]: https://travis-ci.org/css-modules/postcss-modules-local-by-default
[npm-img]: https://img.shields.io/npm/v/postcss-modules-local-by-default.svg?style=flat-square
[npm]: https://www.npmjs.com/package/postcss-modules-local-by-default
[coveralls-img]: https://img.shields.io/coveralls/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
[coveralls]: https://coveralls.io/r/css-modules/postcss-modules-local-by-default?branch=master
[codecov-img]: https://img.shields.io/codecov/c/github/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
[codecov]: https://codecov.io/github/css-modules/postcss-modules-local-by-default?branch=master
[coveralls]: https://coveralls.io/r/css-modules/postcss-modules-local-by-default?branch=master
[codecov-img]: https://img.shields.io/codecov/c/github/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
[codecov]: https://codecov.io/github/css-modules/postcss-modules-local-by-default?branch=master
57 changes: 29 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
{
"name": "postcss-modules-local-by-default",
"version": "3.0.3",
"version": "4.0.0-rc.0",
"description": "A CSS Modules transform to make local scope the default",
"main": "index.js",
"main": "src/index.js",
"author": "Mark Dalgleish",
"license": "MIT",
"files": [
"src"
],
"repository": {
"type": "git",
"url": "https://github.com/css-modules/postcss-modules-local-by-default.git"
},
"engines": {
"node": ">= 6"
"node": ">= 10.13.0 || >= 12.13.0 || >= 14"
},
"keywords": [
"css-modules",
"postcss",
"css",
"postcss-plugin"
],
"author": "Mark Dalgleish",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/css-modules/postcss-modules-local-by-default.git"
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5"
"scripts": {
"prettier": "prettier -l --ignore-path .gitignore .",
"eslint": "eslint --ignore-path .gitignore .",
"lint": "yarn eslint && yarn prettier",
"pretest": "yarn lint",
"test": "tape test/index.js",
"autotest": "chokidar src/index.js test/test.js -c 'yarn test'",
"cover": "istanbul cover test/index.js",
"ci": "yarn pretest && yarn cover",
"prepublishOnly": "yarn test"
},
"dependencies": {
"icss-utils": "^4.1.1",
"postcss": "^7.0.32",
"postcss-selector-parser": "^6.0.2",
"postcss-value-parser": "^4.1.0"
},
"devDependencies": {
"chokidar-cli": "^1.2.3",
"chokidar-cli": "^2.1.0",
"codecov.io": "^0.1.6",
"coveralls": "^3.1.0",
"eslint": "^5.16.0",
"eslint": "^7.9.0",
"istanbul": "^0.4.5",
"postcss": "^8.0.3",
"prettier": "^2.1.2",
"tape": "^5.0.1"
},
"scripts": {
"lint": "eslint index.js test.js",
"pretest": "yarn lint",
"test": "tape test.js",
"autotest": "chokidar index.js test.js -c 'yarn test'",
"precover": "yarn lint",
"cover": "istanbul cover test.js",
"travis": "yarn lint && yarn cover -- --report lcovonly",
"prepublish": "yarn test"
},
"files": [
"index.js"
]
"peerDependencies": {
"postcss": "^8.0.3"
}
}
Loading