@fc3/eslint-plugin 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +673 -0
  2. package/README.md +61 -2
  3. package/bin/compile +55 -0
  4. package/bin/install +5 -0
  5. package/bin/lint +13 -0
  6. package/bin/postpublish +5 -0
  7. package/bin/precompile +55 -0
  8. package/bin/prepublish +7 -0
  9. package/bin/remap-paths +120 -0
  10. package/bin/test +9 -0
  11. package/bin/test-one +32 -0
  12. package/dist/.last-compile-time +1 -0
  13. package/dist/.last-publish-time +1 -0
  14. package/dist/src/config/recommended.d.ts +3 -0
  15. package/dist/src/config/recommended.js +73 -0
  16. package/dist/src/config/recommended.js.map +1 -0
  17. package/dist/src/constant/first-party-scope.d.ts +2 -0
  18. package/dist/src/constant/first-party-scope.js +5 -0
  19. package/dist/src/constant/first-party-scope.js.map +1 -0
  20. package/dist/src/enum/message-type.d.ts +7 -0
  21. package/dist/src/enum/message-type.js +11 -0
  22. package/dist/src/enum/message-type.js.map +1 -0
  23. package/dist/src/enum/module-type.d.ts +7 -0
  24. package/dist/src/enum/module-type.js +11 -0
  25. package/dist/src/enum/module-type.js.map +1 -0
  26. package/dist/src/import-formatter.d.ts +15 -0
  27. package/dist/src/import-formatter.js +52 -0
  28. package/dist/src/import-formatter.js.map +1 -0
  29. package/dist/src/import-sorter.d.ts +10 -0
  30. package/dist/src/import-sorter.js +27 -0
  31. package/dist/src/import-sorter.js.map +1 -0
  32. package/dist/src/import-validator.d.ts +30 -0
  33. package/dist/src/import-validator.js +159 -0
  34. package/dist/src/import-validator.js.map +1 -0
  35. package/dist/src/index.d.ts +2 -0
  36. package/dist/src/index.js +7 -0
  37. package/dist/src/index.js.map +1 -0
  38. package/dist/src/module-classifier.d.ts +15 -0
  39. package/dist/src/module-classifier.js +67 -0
  40. package/dist/src/module-classifier.js.map +1 -0
  41. package/dist/src/plugin.d.ts +8 -0
  42. package/dist/src/plugin.js +23 -0
  43. package/dist/src/plugin.js.map +1 -0
  44. package/dist/src/rule/import-order.d.ts +6 -0
  45. package/dist/src/rule/import-order.js +56 -0
  46. package/dist/src/rule/import-order.js.map +1 -0
  47. package/dist/src/type/validation-error.d.ts +4 -0
  48. package/dist/src/type/validation-error.js +3 -0
  49. package/dist/src/type/validation-error.js.map +1 -0
  50. package/dist/src/utility/compare-import-order.d.ts +4 -0
  51. package/dist/src/utility/compare-import-order.js +30 -0
  52. package/dist/src/utility/compare-import-order.js.map +1 -0
  53. package/dist/src/utility/determine-import-module-type.d.ts +4 -0
  54. package/dist/src/utility/determine-import-module-type.js +12 -0
  55. package/dist/src/utility/determine-import-module-type.js.map +1 -0
  56. package/dist/src/utility/get-import-specifier-length.d.ts +3 -0
  57. package/dist/src/utility/get-import-specifier-length.js +22 -0
  58. package/dist/src/utility/get-import-specifier-length.js.map +1 -0
  59. package/dist/src/utility/get-module-type-label.d.ts +3 -0
  60. package/dist/src/utility/get-module-type-label.js +22 -0
  61. package/dist/src/utility/get-module-type-label.js.map +1 -0
  62. package/package.json +46 -5
@@ -0,0 +1,30 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ import ValidationError from './type/validation-error';
3
+ declare class ImportValidator {
4
+ private root_directory;
5
+ private source_text;
6
+ private imports;
7
+ private errors;
8
+ private last_import;
9
+ private last_module_type;
10
+ constructor(root_directory: string, source_text: string, imports: TSESTree.ImportDeclaration[]);
11
+ validate(): ValidationError[];
12
+ private validateImport;
13
+ private validatePrecedingNewline;
14
+ private validateModuleTypeOrder;
15
+ private validateLengthOrder;
16
+ private validateAbsolutePath;
17
+ private addError;
18
+ private getImportRange;
19
+ private formatImports;
20
+ private classify;
21
+ private getImportPath;
22
+ private hasErrors;
23
+ private getErrors;
24
+ private getImports;
25
+ private getLastImport;
26
+ private getLastModuleType;
27
+ private getRootDirectory;
28
+ private getSourceText;
29
+ }
30
+ export default ImportValidator;
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const module_type_1 = __importDefault(require("./enum/module-type.js"));
7
+ const message_type_1 = __importDefault(require("./enum/message-type.js"));
8
+ const import_formatter_1 = __importDefault(require("./import-formatter.js"));
9
+ const compare_import_order_1 = __importDefault(require("./utility/compare-import-order.js"));
10
+ const get_module_type_label_1 = __importDefault(require("./utility/get-module-type-label.js"));
11
+ const determine_import_module_type_1 = __importDefault(require("./utility/determine-import-module-type.js"));
12
+ class ImportValidator {
13
+ constructor(root_directory, source_text, imports) {
14
+ this.root_directory = root_directory;
15
+ this.source_text = source_text;
16
+ this.imports = imports;
17
+ this.errors = [];
18
+ this.last_import = undefined;
19
+ this.last_module_type = module_type_1.default.CORE;
20
+ }
21
+ validate() {
22
+ const imports = this.getImports();
23
+ imports.forEach((current_import) => {
24
+ const module_type = this.classify(current_import);
25
+ this.validateImport(current_import, module_type);
26
+ this.last_import = current_import;
27
+ this.last_module_type = module_type;
28
+ });
29
+ return this.getErrors();
30
+ }
31
+ validateImport(current_import, module_type) {
32
+ if (this.hasErrors()) {
33
+ return;
34
+ }
35
+ const checks = [
36
+ this.validateModuleTypeOrder,
37
+ this.validatePrecedingNewline,
38
+ this.validateLengthOrder,
39
+ this.validateAbsolutePath
40
+ ];
41
+ checks.forEach((check) => {
42
+ if (!this.hasErrors()) {
43
+ check.call(this, current_import, module_type);
44
+ }
45
+ });
46
+ }
47
+ validatePrecedingNewline(current_import, module_type) {
48
+ const last_import = this.getLastImport();
49
+ if (last_import === undefined) {
50
+ return;
51
+ }
52
+ if (module_type === this.getLastModuleType()) {
53
+ return;
54
+ }
55
+ const current_line = current_import.loc.start.line;
56
+ const last_line = last_import.loc.end.line;
57
+ if (last_line === current_line - 2) {
58
+ return;
59
+ }
60
+ this.addError(message_type_1.default.MISSING_NEWLINE, current_import, {
61
+ type_label: (0, get_module_type_label_1.default)(module_type),
62
+ import_path: this.getImportPath(current_import),
63
+ last_type_label: (0, get_module_type_label_1.default)(this.getLastModuleType()),
64
+ last_import_path: this.getImportPath(last_import)
65
+ });
66
+ }
67
+ validateModuleTypeOrder(current_import, module_type) {
68
+ if (module_type >= this.getLastModuleType()) {
69
+ return;
70
+ }
71
+ this.addError(message_type_1.default.IMPORT_TYPE_ORDER, current_import, {
72
+ type_label: (0, get_module_type_label_1.default)(module_type),
73
+ import_path: this.getImportPath(current_import),
74
+ last_type_label: (0, get_module_type_label_1.default)(this.getLastModuleType())
75
+ });
76
+ }
77
+ validateLengthOrder(current_import, module_type) {
78
+ const last_import = this.getLastImport();
79
+ if (last_import === undefined) {
80
+ return;
81
+ }
82
+ if (module_type !== this.getLastModuleType()) {
83
+ return;
84
+ }
85
+ const comparison = (0, compare_import_order_1.default)(this.getRootDirectory(), last_import, current_import);
86
+ if (comparison <= 0) {
87
+ return;
88
+ }
89
+ this.addError(message_type_1.default.IMPORT_LENGTH_ORDER, current_import, {
90
+ current_import_path: this.getImportPath(current_import),
91
+ last_import_path: this.getImportPath(last_import)
92
+ });
93
+ }
94
+ validateAbsolutePath(current_import, module_type) {
95
+ if (module_type !== module_type_1.default.LOCAL) {
96
+ return;
97
+ }
98
+ const import_path = this.getImportPath(current_import);
99
+ if (!import_path.startsWith('.')) {
100
+ return;
101
+ }
102
+ this.errors.push({
103
+ messageId: message_type_1.default.NON_ABSOLUTE_PATH,
104
+ data: {
105
+ import_path
106
+ },
107
+ node: current_import
108
+ });
109
+ }
110
+ addError(message_type, node, data) {
111
+ this.errors.push({
112
+ messageId: message_type,
113
+ data,
114
+ node,
115
+ fix: (fixer) => {
116
+ return fixer.replaceTextRange(this.getImportRange(), this.formatImports());
117
+ }
118
+ });
119
+ }
120
+ getImportRange() {
121
+ const imports = this.getImports();
122
+ const first_import = imports[0];
123
+ const last_import = imports[imports.length - 1];
124
+ return [first_import.range[0], last_import.range[1]];
125
+ }
126
+ formatImports() {
127
+ const formatter = new import_formatter_1.default(this.getRootDirectory(), this.getSourceText(), this.getImports());
128
+ return formatter.format();
129
+ }
130
+ classify(import_declaration) {
131
+ return (0, determine_import_module_type_1.default)(this.getRootDirectory(), import_declaration);
132
+ }
133
+ getImportPath(import_declaration) {
134
+ return import_declaration.source.value;
135
+ }
136
+ hasErrors() {
137
+ return this.getErrors().length > 0;
138
+ }
139
+ getErrors() {
140
+ return this.errors;
141
+ }
142
+ getImports() {
143
+ return this.imports;
144
+ }
145
+ getLastImport() {
146
+ return this.last_import;
147
+ }
148
+ getLastModuleType() {
149
+ return this.last_module_type;
150
+ }
151
+ getRootDirectory() {
152
+ return this.root_directory;
153
+ }
154
+ getSourceText() {
155
+ return this.source_text;
156
+ }
157
+ }
158
+ exports.default = ImportValidator;
159
+ //# sourceMappingURL=import-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-validator.js","sourceRoot":"","sources":["../../src/import-validator.ts"],"names":[],"mappings":";;;;;AAEA,mEAA0C;AAC1C,qEAA4C;AAC5C,wEAA+C;AAE/C,wFAA8D;AAC9D,0FAA+D;AAC/D,wGAA6E;AAE7E,MAAM,eAAe;IAQpB,YACC,cAAsB,EACtB,WAAmB,EACnB,OAAqC;QAErC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,gBAAgB,GAAG,qBAAU,CAAC,IAAI,CAAC;IACzC,CAAC;IAEM,QAAQ;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,OAAO,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE;YAClC,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,c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,MAAM,SAAS,GAAG,IAAI,0BAAe,CACpC,IAAI,CAAC,gBAAgB,EAAE,EACvB,IAAI,CAAC,aAAa,EAAE,EACpB,IAAI,CAAC,UAAU,EAAE,CACjB,CAAC;QAEF,OAAO,SAAS,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IAEO,QAAQ,CAAC,kBAA8C;QAC9D,OAAO,IAAA,sCAAyB,EAC/B,IAAI,CAAC,gBAAgB,EAAE,EACvB,kBAAkB,CAClB,CAAC;IACH,CAAC;IAEO,aAAa,CACpB,kBAA8C;QAE9C,OAAO,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC;IACxC,CAAC;IAEO,SAAS;QAChB,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IACpC,CAAC;IAEO,SAAS;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAEO,UAAU;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEO,aAAa;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAEO,iBAAiB;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;IAEO,gBAAgB;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC5B,CAAC;IAEO,aAAa;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;CACD;AAED,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ import FC3Plugin from './plugin';
2
+ export = FC3Plugin;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const plugin_1 = __importDefault(require("./plugin.js"));
6
+ module.exports = plugin_1.default;
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,oDAA+B;AAE/B,iBAAS,gBAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ import ModuleType from './enum/module-type';
3
+ declare class ModuleClassifier {
4
+ private root_directory;
5
+ private import_declaration;
6
+ constructor(root_directory: string, import_declaration: TSESTree.ImportDeclaration);
7
+ classify(): ModuleType;
8
+ private isCoreModule;
9
+ private isFirstPartyModule;
10
+ private isLocalModule;
11
+ private hasRelativePath;
12
+ private getPath;
13
+ private getSourceDirectory;
14
+ }
15
+ export default ModuleClassifier;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const module_1 = require("module");
9
+ const module_type_1 = __importDefault(require("./enum/module-type.js"));
10
+ const first_party_scope_1 = __importDefault(require("./constant/first-party-scope.js"));
11
+ const NODE_PREFIX = 'node:';
12
+ const LOCAL_EXTENSIONS = ['.ts', '.tsx', '/index.ts', '/index.tsx'];
13
+ class ModuleClassifier {
14
+ constructor(root_directory, import_declaration) {
15
+ this.root_directory = root_directory;
16
+ this.import_declaration = import_declaration;
17
+ }
18
+ classify() {
19
+ if (this.isCoreModule()) {
20
+ return module_type_1.default.CORE;
21
+ }
22
+ if (this.isLocalModule()) {
23
+ return module_type_1.default.LOCAL;
24
+ }
25
+ if (this.isFirstPartyModule()) {
26
+ return module_type_1.default.FIRST_PARTY;
27
+ }
28
+ return module_type_1.default.THIRD_PARTY;
29
+ }
30
+ isCoreModule() {
31
+ const path = this.getPath();
32
+ if (path.startsWith(NODE_PREFIX)) {
33
+ return true;
34
+ }
35
+ return module_1.builtinModules.includes(path);
36
+ }
37
+ isFirstPartyModule() {
38
+ const path = this.getPath();
39
+ if (path === first_party_scope_1.default) {
40
+ return true;
41
+ }
42
+ return path.startsWith(`${first_party_scope_1.default}/`);
43
+ }
44
+ isLocalModule() {
45
+ if (this.hasRelativePath()) {
46
+ return true;
47
+ }
48
+ const source_directory = this.getSourceDirectory();
49
+ const path = this.getPath();
50
+ const resolved_path = path_1.default.resolve(source_directory, path);
51
+ return LOCAL_EXTENSIONS.some((extension) => {
52
+ return fs_1.default.existsSync(`${resolved_path}${extension}`);
53
+ });
54
+ }
55
+ hasRelativePath() {
56
+ const path = this.getPath();
57
+ return path.startsWith('./') || path.startsWith('../');
58
+ }
59
+ getPath() {
60
+ return this.import_declaration.source.value;
61
+ }
62
+ getSourceDirectory() {
63
+ return path_1.default.resolve(this.root_directory, 'src');
64
+ }
65
+ }
66
+ exports.default = ModuleClassifier;
67
+ //# sourceMappingURL=module-classifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-classifier.js","sourceRoot":"","sources":["../../src/module-classifier.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,mCAAsC;AAItC,mEAA0C;AAC1C,mFAAyD;AAEzD,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;AAEpE,MAAM,gBAAgB;IAIrB,YACC,cAAsB,EACtB,kBAA8C;QAE9C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC9C,CAAC;IAEM,QAAQ;QACd,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;YACzB,OAAO,qBAAU,CAAC,IAAI,CAAC;QACxB,CAAC;QAED,IAAI,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC;YAC1B,OAAO,qBAAU,CAAC,KAAK,CAAC;QACzB,CAAC;QAED,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE,CAAC;YAC/B,OAAO,qBAAU,C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MAAM,CAAC,KAAK,CAAC;IAC7C,CAAC;IAEO,kBAAkB;QACzB,OAAO,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACD;AAED,kBAAe,gBAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { TSESLint } from '@typescript-eslint/utils';
2
+ type Plugin = TSESLint.FlatConfig.Plugin & {
3
+ readonly configs: {
4
+ readonly recommended: TSESLint.FlatConfig.ConfigArray;
5
+ };
6
+ };
7
+ declare const FC3Plugin: Plugin;
8
+ export default FC3Plugin;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const import_order_1 = __importDefault(require("./rule/import-order.js"));
7
+ const recommended_1 = __importDefault(require("./config/recommended.js"));
8
+ const base_plugin = {
9
+ meta: {
10
+ name: '@fc3/eslint-plugin'
11
+ },
12
+ rules: {
13
+ 'import-order': import_order_1.default
14
+ }
15
+ };
16
+ const FC3Plugin = {
17
+ ...base_plugin,
18
+ configs: {
19
+ recommended: (0, recommended_1.default)(base_plugin)
20
+ }
21
+ };
22
+ exports.default = FC3Plugin;
23
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":";;;;;AAEA,qEAAgD;AAChD,qEAAwD;AAQxD,MAAM,WAAW,GAA+B;IAC/C,IAAI,EAAE;QACL,IAAI,EAAE,oBAAoB;KAC1B;IACD,KAAK,EAAE;QACN,cAAc,EAAE,sBAAe;KAC/B;CACD,CAAC;AAEF,MAAM,SAAS,GAAW;IACzB,GAAG,WAAW;IACd,OAAO,EAAE;QACR,WAAW,EAAE,IAAA,qBAAsB,EAAC,WAAW,CAAC;KAChD;CACD,CAAC;AAEF,kBAAe,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ import MessageType from './../enum/message-type';
3
+ declare const ImportOrderRule: ESLintUtils.RuleModule<MessageType, [], unknown, ESLintUtils.RuleListener> & {
4
+ name: string;
5
+ };
6
+ export default ImportOrderRule;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("@typescript-eslint/utils");
7
+ const message_type_1 = __importDefault(require("./../enum/message-type.js"));
8
+ const import_validator_1 = __importDefault(require("./../import-validator.js"));
9
+ const MISSING_NEWLINE_MESSAGE = 'Place a single empty newline between {{ type_label }} ' +
10
+ "import '{{ import_path }}' and the preceding {{ last_type_label }} " +
11
+ "import '{{ last_import_path }}'.";
12
+ const IMPORT_TYPE_ORDER_MESSAGE = "{{ type_label }} import '{{ import_path }}' " +
13
+ 'should occur before any {{ last_type_label }} imports.';
14
+ const IMPORT_LENGTH_ORDER_MESSAGE = "The import for '{{ last_import_path }}' " +
15
+ "is longer than the one for '{{ current_import_path }}', " +
16
+ 'and should be placed after it.';
17
+ const NON_ABSOLUTE_PATH_MESSAGE = "The import '{{ import_path }}' uses a relative path; " +
18
+ 'use an absolute path instead.';
19
+ function getDocsUrl(rule_name) {
20
+ return `https://git.sr.ht/~fc3/eslint-plugin#fc3${rule_name}`;
21
+ }
22
+ const createRule = utils_1.ESLintUtils.RuleCreator(getDocsUrl);
23
+ const ImportOrderRule = createRule({
24
+ name: 'import-order',
25
+ meta: {
26
+ type: 'problem',
27
+ docs: {
28
+ description: 'Ensures that imports are grouped and ordered consistently'
29
+ },
30
+ messages: {
31
+ [message_type_1.default.IMPORT_TYPE_ORDER]: IMPORT_TYPE_ORDER_MESSAGE,
32
+ [message_type_1.default.IMPORT_LENGTH_ORDER]: IMPORT_LENGTH_ORDER_MESSAGE,
33
+ [message_type_1.default.MISSING_NEWLINE]: MISSING_NEWLINE_MESSAGE,
34
+ [message_type_1.default.NON_ABSOLUTE_PATH]: NON_ABSOLUTE_PATH_MESSAGE
35
+ },
36
+ schema: [],
37
+ fixable: 'code'
38
+ },
39
+ defaultOptions: [],
40
+ create(context) {
41
+ const imports = [];
42
+ return {
43
+ ImportDeclaration(node) {
44
+ imports.push(node);
45
+ },
46
+ 'Program:exit'() {
47
+ const validator = new import_validator_1.default(context.cwd, context.sourceCode.text, imports);
48
+ validator.validate().forEach((error) => {
49
+ context.report(error);
50
+ });
51
+ }
52
+ };
53
+ }
54
+ });
55
+ exports.default = ImportOrderRule;
56
+ //# sourceMappingURL=import-order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-order.js","sourceRoot":"","sources":["../../../src/rule/import-order.ts"],"names":[],"mappings":";;;;;AAAA,oDAA+D;AAE/D,qEAA4C;AAC5C,wEAA+C;AAE/C,MAAM,uBAAuB,GAC5B,wDAAwD;IACxD,qEAAqE;IACrE,kCAAkC,CAAC;AAEpC,MAAM,yBAAyB,GAC9B,8CAA8C;IAC9C,wDAAwD,CAAC;AAE1D,MAAM,2BAA2B,GAChC,0CAA0C;IAC1C,0DAA0D;IAC1D,gCAAgC,CAAC;AAElC,MAAM,yBAAyB,GAC9B,uDAAuD;IACvD,+BAA+B,CAAC;AAEjC,SAAS,UAAU,CAAC,SAAiB;IACpC,OAAO,2CAA2C,SAAS,EAAE,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAEvD,MAAM,eAAe,GAAG,UAAU,CAAC;IAClC,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACL,WAAW,EAAE,2DAA2D;SACxE;QACD,QAAQ,EAAE;YACT,CAAC,sBAAW,CAAC,iBAAiB,CAAC,EAAE,yBAAyB;YAC1D,CAAC,sBAAW,CAAC,mBAAmB,CAAC,EAAE,2BAA2B;YAC9D,CAAC,sBAAW,CAAC,eAAe,CAAC,EAAE,uBAAuB;YACtD,CAAC,sBAAW,CAAC,iBAAiB,CAAC,EAAE,yBAAyB;SAC1D;QACD,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,MAAM;KACf;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACb,MAAM,OAAO,GAAiC,EAAE,CAAC;QAEjD,OAAO;YACN,iBAAiB,CAAC,IAAI;gBACrB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;YACD,cAAc;gBACb,MAAM,SAAS,GAAG,IAAI,0BAAe,CACpC,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,UAAU,CAAC,IAAI,EACvB,OAAO,CACP,CAAC;gBAEF,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEH,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { TSESLint } from '@typescript-eslint/utils';
2
+ import MessageType from './../enum/message-type';
3
+ type ValidationError = TSESLint.ReportDescriptor<MessageType>;
4
+ export default ValidationError;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=validation-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-error.js","sourceRoot":"","sources":["../../../src/type/validation-error.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ type ImportComparison = -1 | 0 | 1;
3
+ declare function compareImportOrder(root_directory: string, import_a: TSESTree.ImportDeclaration, import_b: TSESTree.ImportDeclaration): ImportComparison;
4
+ export default compareImportOrder;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const get_import_specifier_length_1 = __importDefault(require("./get-import-specifier-length.js"));
7
+ const determine_import_module_type_1 = __importDefault(require("./determine-import-module-type.js"));
8
+ function compareNumbers(a, b) {
9
+ if (a === b) {
10
+ return 0;
11
+ }
12
+ return a < b ? -1 : 1;
13
+ }
14
+ function getImportLength(import_declaration) {
15
+ const [start, end] = import_declaration.range;
16
+ return end - start;
17
+ }
18
+ function compareImportOrder(root_directory, import_a, import_b) {
19
+ const type_comparison = compareNumbers((0, determine_import_module_type_1.default)(root_directory, import_a), (0, determine_import_module_type_1.default)(root_directory, import_b));
20
+ if (type_comparison !== 0) {
21
+ return type_comparison;
22
+ }
23
+ const specifier_comparison = compareNumbers((0, get_import_specifier_length_1.default)(import_a), (0, get_import_specifier_length_1.default)(import_b));
24
+ if (specifier_comparison !== 0) {
25
+ return specifier_comparison;
26
+ }
27
+ return compareNumbers(getImportLength(import_a), getImportLength(import_b));
28
+ }
29
+ exports.default = compareImportOrder;
30
+ //# sourceMappingURL=compare-import-order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-import-order.js","sourceRoot":"","sources":["../../../src/utility/compare-import-order.ts"],"names":[],"mappings":";;;;;AAEA,sGAA2E;AAC3E,wGAA6E;AAI7E,SAAS,cAAc,CAAC,CAAS,EAAE,CAAS;IAC3C,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACb,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,eAAe,CACvB,kBAA8C;IAE9C,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC;IAE9C,OAAO,GAAG,GAAG,KAAK,CAAC;AACpB,CAAC;AAED,SAAS,kBAAkB,CAC1B,cAAsB,EACtB,QAAoC,EACpC,QAAoC;IAEpC,MAAM,eAAe,GAAG,cAAc,CACrC,IAAA,sCAAyB,EAAC,cAAc,EAAE,QAAQ,CAAC,EACnD,IAAA,sCAAyB,EAAC,cAAc,EAAE,QAAQ,CAAC,CACnD,CAAC;IAEF,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,eAAe,CAAC;IACxB,CAAC;IAED,MAAM,oBAAoB,GAAG,cAAc,CAC1C,IAAA,qCAAwB,EAAC,QAAQ,CAAC,EAClC,IAAA,qCAAwB,EAAC,QAAQ,CAAC,CAClC,CAAC;IAEF,IAAI,oBAAoB,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,oBAAoB,CAAC;IAC7B,CAAC;IAED,OAAO,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ import ModuleType from './../enum/module-type';
3
+ declare function determineImportModuleType(root_directory: string, import_declaration: TSESTree.ImportDeclaration): ModuleType;
4
+ export default determineImportModuleType;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const module_classifier_1 = __importDefault(require("./../module-classifier.js"));
7
+ function determineImportModuleType(root_directory, import_declaration) {
8
+ const classifier = new module_classifier_1.default(root_directory, import_declaration);
9
+ return classifier.classify();
10
+ }
11
+ exports.default = determineImportModuleType;
12
+ //# sourceMappingURL=determine-import-module-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"determine-import-module-type.js","sourceRoot":"","sources":["../../../src/utility/determine-import-module-type.ts"],"names":[],"mappings":";;;;;AAGA,0EAAiD;AAEjD,SAAS,yBAAyB,CACjC,cAAsB,EACtB,kBAA8C;IAE9C,MAAM,UAAU,GAAG,IAAI,2BAAgB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAE5E,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC;AAED,kBAAe,yBAAyB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ declare function getImportSpecifierLength(import_declaration: TSESTree.ImportDeclaration): number;
3
+ export default getImportSpecifierLength;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@typescript-eslint/utils");
4
+ const BRACE_LENGTH = 2;
5
+ const DELIMITER_LENGTH = 2;
6
+ function getImportSpecifierLength(import_declaration) {
7
+ const { specifiers } = import_declaration;
8
+ if (specifiers.length === 0) {
9
+ return 0;
10
+ }
11
+ const specifier_length = specifiers.reduce((total, specifier) => {
12
+ return total + specifier.range[1] - specifier.range[0];
13
+ }, 0);
14
+ const has_named_specifier = specifiers.some((specifier) => {
15
+ return specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier;
16
+ });
17
+ const brace_length = has_named_specifier ? BRACE_LENGTH : 0;
18
+ const delimiter_length = (specifiers.length - 1) * DELIMITER_LENGTH;
19
+ return specifier_length + brace_length + delimiter_length;
20
+ }
21
+ exports.default = getImportSpecifierLength;
22
+ //# sourceMappingURL=get-import-specifier-length.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-import-specifier-length.js","sourceRoot":"","sources":["../../../src/utility/get-import-specifier-length.ts"],"names":[],"mappings":";;AAAA,oDAAkE;AAElE,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,SAAS,wBAAwB,CAChC,kBAA8C;IAE9C,MAAM,EAAC,UAAU,EAAC,GAAG,kBAAkB,CAAC;IAExC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,CAAC;IACV,CAAC;IAED,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QAC/D,OAAO,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,MAAM,mBAAmB,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;QACzD,OAAO,SAAS,CAAC,IAAI,KAAK,sBAAc,CAAC,eAAe,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,MAAM,gBAAgB,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,gBAAgB,CAAC;IAEpE,OAAO,gBAAgB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAC3D,CAAC;AAED,kBAAe,wBAAwB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import ModuleType from './../enum/module-type';
2
+ declare function getModuleTypeLabel(module_type: ModuleType): string;
3
+ export default getModuleTypeLabel;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const module_type_1 = __importDefault(require("./../enum/module-type.js"));
7
+ function getModuleTypeLabel(module_type) {
8
+ switch (module_type) {
9
+ case module_type_1.default.CORE:
10
+ return 'core';
11
+ case module_type_1.default.THIRD_PARTY:
12
+ return 'third-party';
13
+ case module_type_1.default.FIRST_PARTY:
14
+ return 'first-party';
15
+ case module_type_1.default.LOCAL:
16
+ return 'local';
17
+ default:
18
+ throw new Error(`Invalid module type: ${module_type}`);
19
+ }
20
+ }
21
+ exports.default = getModuleTypeLabel;
22
+ //# sourceMappingURL=get-module-type-label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-module-type-label.js","sourceRoot":"","sources":["../../../src/utility/get-module-type-label.ts"],"names":[],"mappings":";;;;;AAAA,mEAA0C;AAE1C,SAAS,kBAAkB,CAAC,WAAuB;IAClD,QAAQ,WAAW,EAAE,CAAC;QACrB,KAAK,qBAAU,CAAC,IAAI;YACnB,OAAO,MAAM,CAAC;QAEf,KAAK,qBAAU,CAAC,WAAW;YAC1B,OAAO,aAAa,CAAC;QAEtB,KAAK,qBAAU,CAAC,WAAW;YAC1B,OAAO,aAAa,CAAC;QAEtB,KAAK,qBAAU,CAAC,KAAK;YACpB,OAAO,OAAO,CAAC;QAEhB;YACC,MAAM,IAAI,KAAK,CAAC,wBAAwB,WAAW,EAAE,CAAC,CAAC;IACzD,CAAC;AACF,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
- "name": "@fc3/eslint-plugin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@fc3/eslint-plugin",
3
+ "description": "Custom ESLint rules and the shared lint configuration for @fc3 projects",
4
+ "version": "0.1.0",
5
+ "author": "fc3",
6
+ "private": false,
7
+ "homepage": "https://0xfc3.net/software/utilities",
8
+ "repository": "https://git.sr.ht/~fc3/eslint-plugin",
9
+ "license": "GPL-3.0-or-later",
10
+ "main": "./dist/src/index.js",
11
+ "types": "./dist/src/index.d.ts",
12
+ "files": [
13
+ "dist/",
14
+ "!dist/src/test/",
15
+ "!dist/test/",
16
+ "package.json",
17
+ "README.md",
18
+ "bin/"
19
+ ],
20
+ "dependencies": {
21
+ "@eslint/js": "^9.34.0",
22
+ "@typescript-eslint/utils": "^8.41.0",
23
+ "eslint-config-prettier": "^10.1.8",
24
+ "typescript-eslint": "^8.41.0"
25
+ },
26
+ "peerDependencies": {
27
+ "eslint": "^9.34.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "22.13.10",
31
+ "@typescript-eslint/parser": "^8.41.0",
32
+ "eslint": "^9.34.0",
33
+ "prettier": "^3.6.2",
34
+ "typescript": "^5.7.2"
35
+ },
36
+ "engines": {
37
+ "npm": ">= 10.2.0",
38
+ "node": ">= v23.0.0"
39
+ },
40
+ "scripts": {
41
+ "install": "./bin/install",
42
+ "test": "./bin/test",
43
+ "lint": "./bin/lint",
44
+ "prepublishOnly": "./bin/prepublish",
45
+ "postpublish": "./bin/postpublish"
46
+ }
47
+ }